Help me in writing XSQL
Please find the XML file in a XMLTable at the end.
Please help me out to extract the node value for the fragement <CUST_TRX_TYPE_NAME> and when the TRX_NUMBER value is 00037994.
Thanks in Advance
cheers
anu...
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="sj-trx-line.xsl"?>
<DOCUMENT>
<TRX>
<RA_INTERFACE_LINE>
<MEMO_LINE_NAME> FREIGHT </MEMO_LINE_NAME>
<TRX_NUMBER> 00037994 </TRX_NUMBER>
<CUST_TRX_TYPE_NAME> SAN JOSE INVOICE </CUST_TRX_TYPE_NAME>
</RA_INTERFACE_LINE>
<RA_INTERFACE_LINE>
<MEMO_LINE_NAME> SAN JOSE FREIGHT/TAX LINE </MEMO_LINE_NAME>
<TRX_NUMBER> 00037995 </TRX_NUMBER>
<CUST_TRX_TYPE_NAME> SAN JOSE INVOICE </CUST_TRX_TYPE_NAME>
</RA_INTERFACE_LINE>
</TRX>
</DOCUMENT>
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl"?>
<xsql:query connection="demo"
SELECT CUST_TRX_TYPE_NAME From table WHERE TRX_NUMBER ='00037994'
</xsql:query>
Similar Messages
-
help needed for writing query
i have the following tables(with data) as mentioned below
FK*-foregin key (SUBJECTS)
FK**-foregin key (COMBINATION)
1)SUBJECTS(table name)
SUB_ID(NUMBER) SUB_CODE(VARCHAR2) SUB_NAME (VARCHAR2)
2 02 Computer Science
3 03 Physics
4 04 Chemistry
5 05 Mathematics
7 07 Commerce
8 08 Computer Applications
9 09 Biology
2)COMBINATION
COMB_ID(NUMBER) COMB_NAME(VARCHAR2) SUB_ID1(NUMBER(FK*)) SUB_ID2(NUMBER(FK*)) SUB_ID3(NUMBER(FK*)) SUBJ_ID4(NUMBER(FK*))
383 S1 9 4 2 3
384 S2 4 2 5 3
---------I actually designed the ABOVE table also like this
3) a)COMBINATION
COMB_ID(NUMBER) COMB_NAME(VARCHAR2)
383 S1
384 S2
b)COMBINATION_DET
COMBDET_ID(NUMBER) COMB_ID(FK**) SUB_ID(FK*)
1 383 9
2 383 4
3 383 2
4 383 3
5 384 4
6 384 2
7 384 5
8 384 3
Business rule: a combination consists of a maximum of 4 subjects (must contain)
and the user is less relevant to a COMB_NAME(name of combinations) but user need
the subjects contained in combinations
i need the following output
COMB_ID COMB_NAME SUBJECT1 SUBJECT2 SUBJECT3 SUBJECT4
383 S1 Biology Chemistry Computer Science Physics
384 S2 Chemistry Computer Science Mathematics Physics
or even this is enough(what i actually needed)
COMB_ID subjects
383 Biology,Chemistry,Computer Science,Physics
384 Chemistry,Computer Science,Mathematics,Physics
you can use any of the COMBINATION table(either (2) or (3))
and i want to know
1)which design is good in this case
(i think SUB_ID1,SUB_ID2,SUB_ID3,SUB_ID4 is not a
good method to link with same table but if 4 subjects only(and must) comes
detail table is not neccessary )
now i am achieving the result by program-coding in C# after getting the rows from oracle
i am using oracle 9i (also ODP.NET)
i want to know how can i get the result in the stored procedure itsef.
2)how it could be designed in any other way.
any help/suggestion is welcome
thanks for your time --PradeeshWell I forgot the table-alias, here now with:
SELECT C.COMB_ID
, C.COMB_NAME
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID1) AS SUBJECT_NAME1
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID2) AS SUBJECT_NAME2
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID3) AS SUBJECT_NAME3
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID4) AS SUBJECT_NAME4
FROM COMBINATION C;
As you need exactly 4 subjects, the columns-solution is just fine I would say. -
Hi,
Could anyone help me in writing below query without syntax errors.
I tried but no luck
select xmlelement("g", XMLATTRIBUTES(g.contentgroup_id as "id",g.groupname as "label",
(select xmlagg(xmlelement ("c",XMLATTRIBUTES(c.title as "title",c.content_id as "id")))) as "A"))
as "A" from
(SELECT g.contentgroup_id AS id, g.groupname AS label, c.title AS label, c.content_id AS id
FROM content_ec c FULL OUTER JOIN contentgroup_ec g ON c.group_id = g.contentgroup_id
oRDER BY g.groupname ,c.title ASC );
Any help really appreciated.
ThanksFew tips to get your question answered here
1. Give your database version. Some thing that does not work in one version works fine in the next. And 8i,9i or 10g is not version. best way to give the version is to query your v$version table like this.
SQL> select * from v$version where rownum = 1
2 /
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod2. You should understand we don't have what you have, meaning you should provide your data structure and some sample data for us to help.
3. "I got an error"... "Its not working"... and the list goes on. Sentences like this does not help. If you got a error past the entire error. If stuff does not work, tell us the details.
4. Just don't throw some output and say i want it. Please explain to every one how you derive it.
5. And the most important thing. Use \...\ tag to format. Please.. Please.. Please.. use it. It helps every one a lot. When you use it your SQL looks some thing like this.
SELECT xmlelement("g", XMLATTRIBUTES(g.contentgroup_id as "id",g.groupname as "label",
(select xmlagg(xmlelement ("c",XMLATTRIBUTES(c.title as "title",c.content_id as "id")))) as "A")) as "A"
FROM (SELECT g.contentgroup_id AS id,
g.groupname AS label,
c.title AS label,
c.content_id AS id
FROM content_ec c
FULL OUTER JOIN contentgroup_ec g
ON c.group_id = g.contentgroup_id
ORDER BY g.groupname ,c.title ASC );6. And also do search this forum. Most of your my queries are answered by simple search.
Thanks,
Karthick. -
Help needed in writing a function.
I am using Oracle 11g and SQL plus. I am a complete newbie, so I need some help here in writing a function. I guess my question is more about writing the trigonometric functions within the function.
latA, longA latB, longB // these are the four input parameters,
theta = longA - longB
distX = sin( latA * PI / 180) * sin ( latB * PI /180) + cos ( latA * PI/180) * cos ( latB * PI/180) * cos ( theta * PI / 180)
distY = acos(distX) // this is arc cosine
distZ = distY * 180 / PI // PI refers to the mathematical PI
distP = distZ * 60 * 1.1515; // this value should be returned. Of course the intermediate variable names don't matter.
Please help. Thanks.CREATE OR REPLACE FUNCTION fucntion_name(latA IN NUMBER, longA IN NUMBER, latB IN NUMBER, longB IN NUMBER) RETURN NUMBER
IS
pi CONSTANT NUMBER:=3.14159;
theta NUMBER;
distX NUMBER;
distY NUMBER;
distZ NUMBER;
distP NUMBER;
BEGIN
theta :=longA - longB;
distX :=sin( latA * PI /180) * sin ( latB * PI /180) + cos ( latA * PI/180) * cos ( latB * PI/180) * cos ( theta * PI / 180);
distY :=acos(distX); --this is arc cosine
distZ :=distY * 180/PI; --PI refers to the mathematical PI
distP :=distZ * 60 * 1.1515; --this value should be returned. Of course the intermediate variable names don't matter.
RETURN distP;
END;Edited by: Ora on May 3, 2011 11:46 PM -
Help required in writing an sql to fetch the the difference of the data.
Hi Gurus,
Could some one help me in writing an sql to pull data the difference between two same structured tables from two different database and to store that data in an temperory table.
many many thanks in advanceLets say you have two db SOURCE and DEST
SOURCE is the DB that you have Logged in into. Now you do the following.
1. Createa DBLink to DEST database.
2. Check if the DBLink works properly.
3. Then execute the following sql.
select <column_list> from <table_name>
minus
select <column_list> from <table_name>@<dblink>
union all
select <column_list> from <table_name>@<dblink>
minus
select <column_list> from <table_name> -
Please help me in writing the SQL
Hi,
I am new to oracle.. Can you please help me in writing a SQL
I have a table which has the following columns
Start_date m1 ---- Start month of each quarter (Jan,Apr,Jul,oct)
end_date m3---- End month of each quarter
m1_start_date,
m1_end_date,
m2_start_date,
m2_end_date,
m3_start_date,
m3_end_date,
M1_act_rev,
m2_act_rev,
m3_act_rev
If a user selects the dates from Jan,2011 to Jun, 2011
I should get the aggregate of the revenues (m1+m2+m3+m1+m2+m3)Hi Gurus,
Will this work
select
b.DISTRICT_NAME,
count(c.CONTRACT_NUMBER),
sum(C.M1_ACT_REV),
sum(C.M2_ACT_REV),
sum(C.M3_ACT_REV),
sum(C.M1_EXP_PRICE),
sum(C.M2_EXP_PRICE),
sum(C.M3_EXP_PRICE)
from
clm_mn_compliance_data c,
CLM_MN_CUSTOMER_ALIGNMENT_DATA b
where
((m1_start_date between '01-01-2011' and '03-31-2011' ) and (m1_end_date between '01-01-2011' and '03-31-2011')) or
((m2_start_date between '01-01-2011' and '03-31-2011' ) and (m3_end_date between '01-01-2011' and '03-31-2011')) or
((m3_start_date between '01-01-2011' and '03-31-2011' ) and (m3_end_date between '01-01-2011' and '03-31-2011')) and
b.CUSTOMER_ID = C.CUST_CTRT_ID
group by
B.DISTRICT_NAME; -
Could you please help me in writing query
Hi,
Data in table
ID -- H_squ -- D_squ --- Note
0001 1 1 he is
0001 1 2 coming
0001 1 3 from US
0001 2 2 he is going
0001 2 5 Back to US
0002 1 3 he took
0002 1 2 his laguage
0002 2 3 bi
output shouldbe
ID -- H_squ -- D_squ --- Note
<0001> <1> <1,2,3> <he is coming from US>
<0001> < 2 > <2,5> < he is going Back to US>
<0002> <1> <3,2> <he took his laguage>
<0002> <2> <3> <bi>
Actually I used STRAGG function But i am not getting expected output
group by ID, H_squ concat data order by D_squ column
Note should contain concat of D_squ(1,2,3) in this order
Could you please help me in writing queryThis forum is for issues related to Advanced Queuing.
Please only post in forums where your questions are appropriate. -
Help me for writing the password script on solaris
hi,
help me for writing password scripts to change the user/root password.
in the script itself myself want to mention the new password.
now user want to login with the new password only.
model script:
echo $test:`perl -e '$x=crypt('$test123','test');
print $x'`::::::: >> /etc/shadow
test--->username
test123---->new password.
the above script is not working.
kindly help me for writing the script.
Regards,
rajaWell. For one thing, if you just append the new password to the /etc/shadow file there will be two entries for the user in that file (at least if the user already had a password). Which probably is a bad thing.
-
How doest jdk docs help as in writing java code?
hi i wonder how does jdk docs help as in writing java code because if i google a java code the jdk docs always becomes the result of my search but in my experience jdk docs never helps me.
is there any one know how to use jdk docs? and how to get the code from there.
im telling about jdk docs from here http://download.oracle.com/javase/1.4.2/docs/api/
cross posted from http://www.thenewboston.com/forum/viewtopic.php?f=119&t=13778
Edited by: 871484 on Jul 18, 2011 4:18 PM871484 wrote:
ok can any one give me example how to use jdk docs? for example this code
Your question still does not make any sense, and you still haven't clarified what you're not understanding.
However, if you think that just by reading the API docs, with no other training or study, that you will be able to write that code, then you are seriously misunderstanding the purpose of the docs.
Obviously English is not your native language. You grew up speaking some other language at home and with your friends, and at some point in school or as private study, you started to learn English. You learned about the grammar and the alphabet and pronunciation, sentence structure, word order, etc. Now you have the basics of how the language works, and you know some words. When you want to learn new words to fit into the structure you have learned, you use a dictionary.
If you didn't study the grammar, sentence structure, etc., and just said, "I want to learn English. I will look at a dicationary," clearly that would not work.
Right?
So, since you now understand and agree with the English example, let me state something that I hope is obvious to you by now: The API docs are your dictionary. They are not a substitute for learning the language basics.
Furthermore, once you know the language basics in English and have your dictionary, you still won't know how to write a resume (which you may know as a CV). You will look at examples and perhaps take a course on resume (CV) writing. Just reading a dictionary won't help you write a resume(CV). Similarly, if you know some Java basics, you can't learn how to write a Swing app just by reading the Javadocs. You'll look at tutorials and examples. Then, once you know the basic structure of a Swing app, you'll look to the javadocs for more details about more kinds of GUI classes--different buttons and windows and panes and panels and layout managers, etc. -
Help needed in writing a Query/Procedure
Hello All,
Need all ur help in writing a query or procedure
Lets say the Table name is DEMO
There i have one column like num it has values
1
2
3
4
5
8
9
10
my query output should be
1-5
8-10
i,e .. if the diff between two rows is greater than 1 then it result should be in a separate group
I need a query/Procedure for this. Kindly help
Regards,
ChandraTried obtaining the output using SQL and the result is as follows:
SQL> WITH T AS
2 (
3 SELECT 1 COL1 FROM DUAL
4 UNION
5 SELECT 2 COL1 FROM DUAL
6 UNION
7 SELECT 3 COL1 FROM DUAL
8 UNION
9 SELECT 4 COL1 FROM DUAL
10 UNION
11 SELECT 5 COL1 FROM DUAL
12 UNION
13 SELECT 8 COL1 FROM DUAL
14 UNION
15 SELECT 9 COL1 FROM DUAL
16 UNION
17 SELECT 10 COL1 FROM DUAL
18 UNION
19 SELECT 13 COL1 FROM DUAL
20 UNION
21 SELECT 14 COL1 FROM DUAL
22 UNION
23 SELECT 15 COL1 FROM DUAL
24 UNION
25 SELECT 16 COL1 FROM DUAL
26 UNION
27 SELECT 23 COL1 FROM DUAL
28 UNION
29 SELECT 24 COL1 FROM DUAL
30 )
31 SELECT OUTPUT FROM
32 (
33 SELECT DECODE(COL3,NULL,COL1, COL2) || '-' || LEAD(DECODE(COL3,NULL,COL3, COL1)) OVER (ORDER BY DECODE(COL3,NULL,COL1, COL2)) OUTPUT FROM
34 (
35 SELECT COL1, LEAD(COL1) OVER (ORDER BY COL1) COL2, LAG(COL1) OVER (ORDER BY COL1) COL3 FROM T
36 )
37 WHERE
38 (COL2 - COL1 > 1 OR COL2 IS NULL OR COL3 IS NULL)
39 )
40 WHERE OUTPUT != '-';
OUTPUT
1-5
8-10
13-16
23-24 -
Help required in writing And Reading Xml From Database
Hi
i m new to java.
i m facing problem while writing Xml file from Mysql Database in java i m using the WebRowSet
and also for Reading WebRowSet
after reading the Xml i have to save this in Database
(required source code)
is there any one to help me in this way
regards
aamirshadab_think_globally wrote:
{noformat}*hi everybody,
please send me a ajax with jsp application
suppose i enter a word in text area ajax will populate/suggest all string from database ,who started
from that entering character(s).like a google string search.
please send full source code
*{noformat}how about you do it yourself? -
I am a student. I've been trying to install and use Visual Studio 2013 Professional for three weeks now and I cannot get it to work. I am now two weeks behind in my Visual Basic class. I've installed, uninstalled, ran the repair option...
I've tried everything I know how to do. I just spent 45 minutes on the phone with Microsoft, was transferred four times and finally told I will have to use the forums to find an answer. I'm almost completely out of patience with this.
I got the software through the Dream Spark program as a student. I installed it with the web installer and it appeared to install fine. When I try to create a new project, I get the error: "Error writing the project file. The
specified module could not be found."
When I exit the application, I also get: "The automatically saved settings file 'c:\users\user\documents\visual studio 2013\Settings\CurrentSettings-2015-02-02.vssettings' is not available for write. You can change this file on the 'Import
and Export Settings' Tools Options page."
Please tell me you can help.Hi,
could you please try the points mentioned here:
http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/0376db8f-4761-4ae5-9af2-98c53216318a#VS_IDE_unexpected_problems to eliminate the possible cause of your issue?
Please update the result in the forum after you try the method above!
Best Wishes!
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a
href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey. -
Please help me in writing .jad file
Hi friends,
i am getting some problem in writing .jad file
in J2ME.
by now i created .java file
from .java -> .class -> preverifying, o/p -> .class
->.jar files -> finally i need to create .jad
i am trying to create a midlet.
if you know some useful resource available or reference, any thing is good for me right now.
thanks
sumitthanks friends,
any how i got it how to do it,
in future if anybody needs help,
contact me at
[email protected] -
Help needed in writing SQL CASE or DECODE statement
Hi experts,
I need to write a SQL to select order_num, cntry_cde, prod_id and Qty by joining order_num on PROD_ORDER and PROD_ORDER_TXT.
Here is my sample data
PRODORDER_
order_num cntry_cde Prod_id Qty
100 US A1 5
101 US A2 10
102 AU A3 4
103 AU A4 9
104 IN A5 3
PRODORDER_TXT_
order_num cntry_cde Prod_id
100 US A1
101 US A2
102 NZ A3
103 AU A4
104 A5
Here is the requirement,
1) If the cntry_cde in PROD_ORDER is same as cntry_cde in PROD_ORDER_TXT then select PROD_ORDER.cntry_cde (orders 100, 101, 103)
2) If they are different, pick the country code from PROD_ORDER_TXT (order 102, AU <> NZ)
3) If they are different and PROD_ORDER_TXT.cntry_cde is NULL, I cannot use it as cntry_cde in my report (order 104). It happenend just because of the bad data at source.
I cannot avoid it. Then simply use the cntry_cde from PROD_ORDER
Output expected
100 US A1 5
101 US A2 10
102 NZ A3 4 -- AU changed to NZ
103 AU A4 9
104 IN A5 3 -- IN retained as PROD_ORDER_TXT.cntry_cde is null
sample table creation and insert statements are below
create table prod_order
(order_num number,
cntry_cde CHAR(2),
prod_id VARCHAR2(6),
qty number)
create table prod_order_txt
(order_num number,
cntry_cde CHAR(2),
prod_id VARCHAR2(6))
insert into prod_order values (100, 'US', 'A1',5);
insert into prod_order values (101, 'US', 'A2',1);
insert into prod_order values (102, 'AU', 'A3',4);
insert into prod_order values (103, 'AU', 'A4',9);
insert into prod_order values (104, 'IN', 'A5',3);
insert into prod_order_txt values (100,'US','A1');
insert into prod_order_txt values (101,'US','A2');
insert into prod_order_txt values (102,'NZ','A3');
insert into prod_order_txt values (103,'AU','A4');
insert into prod_order_txt values (104,NULL,'A5');
commit;
Thanks for your help in advance
Edited by: sarvan on Mar 28, 2012 1:39 PMHello
Thank you for posting all of the ddl and test data along with your expected output - very helpful!. One small point would be to remember to type {noformat}{noformat} before and after any section of code or data in your post so that formatting is retained. Anyway, this should be a simple join and a combination of CASE and NVL...Select
po.order_num,
CASE
WHEN po.cntry_cde != NVL(pot.cntry_cde,po.cntry_cde)
THEN
pot.cntry_cde
ELSE
po.cntry_cde
END cntry_code,
po.prod_id,
po.qty
FROM
prod_order po
JOIN
prod_order_txt pot
ON
( po.order_num = pot.order_num
ORDER_NUM CN PROD_I QTY
100 US A1 5
101 US A2 1
102 NZ A3 4
103 AU A4 9
104 IN A5 3
5 rows selected.
HTH
David
Edited by: Bravid on Mar 28, 2012 8:32 AM
corrected != -
Urgent help needed on writing errors in to windows events application logs
Hi all,
we have web based application. Whenever there is critical errors encounters in our application we need to write that errors in to windows
event viewer, application logs. Please help me on how to do this.
do we have any specific API for this ?
thanks in advance
ShivakumarYou should use WinAPI to do so. Asking in JNI forum (or specialized WinAPI forum) for more details is good idea I think.
Maybe you are looking for
-
....?
-
Premiere Elements 12 crashes Windows 7 Pro x64 machine
I'm experiencing a problem when going to Publish and having Premiere generate a video file. I'm noticing that my CPU is pegged at 100% for all 4 cores. This happens during rendering when going to Publish and attempting to save the file to my computer
-
Transfer postings to PCA.
Hi all In profit center accounting, I'm facing a problem with transfer of payables and receivables. I've run the steps F.5D and 1KEK to transfer the data, but there are 4 items related to a sales order which are balancing to zero in GL but not in PCA
-
Problems debugging PL/SQL [JDev 9.0.3.1035 Prod]
When debugging a PL/SQL procedure/function JDev creates a temporary procedure, usually called JDEV_TMP_PROC_n. From time to time it happens, that this procedure remains in the database after termination. In this case, it can not be dropped neither wi
-
I've got an IPCCX enhanced install with some custom auto attendant scripts running. On one particular app, phone contacts are accepted and put into a queue for agents to answer. I have business hours and days put in place and some error handling fo