Xmltype extract/extractValue query problem
I am tring to use xmltype extract/extractValue.
The query result never shown up, instead, it only
display 'Answer goes here' or "10 rows selected".
Same select statement used in java program got a null
return.
Anybody knows why?
Honglin
SQL> select extractValue(xml_data, '/FAQ-LIST/QUESTION/RESPONSE/text()')
2 from XMLTable
3 where existsNode(xml_data, '/FAQ-LIST/QUESTION[QUERY="Question 1"]') = 1;
EXTRACTVALUE(XML_DATA,'/FAQ-LIST/QUESTION/RESPONSE/TEXT()')
Answer goes here.
Can you provide the sample XML file?
Similar Messages
-
XML escape sequences for brackets and xmltype.extract
G'day gang, I'm hoping somebody would be kind enough to help me with the following query please.
I have a web service that is returning the following XML stream into an XMLType in the database:
<OutOfStockAdviceResponse xmlns="http://abc.org/abcWebServices">
<OutOfStockAdviceResult>
& lt;Response& lt;ResponseCode& gt;0& lt;/ResponseCode& gt;
& lt;ResponseMessage& gt;Successful& lt;/ResponseMessage& gt;
& lt;/Response& gt;
</OutOfStockAdviceResult>
</OutOfStockAdviceeResponse>You'll note the & lt; and & gt; characters (note to display these strings in OTN I've had to add a space between the & and the lt; or gt;. The spaces don't actually occur in the real XML data coming back).
What's odd about this XML stream coming back is it is mixing the use of the XML angle brackets with the escape character equivalents (eg. & lt; and & gt;) half way through the XML stream. Is this valid for an XML stream to do this? Any idea what would cause this? Is it possible the source is creating 2 separate XML streams using different character sets and then concatenating them to get this result?
The reason I'm asking is I'm attempting via PL/SQL to extract the ResponseCode and ResponseMessage tags with the following code:
v_response_code := XMLType.extract(v_response,
'/OutOfStockAdviceResponse/OutOfStockAdviceResult/Response/ResponseCode/text()',
'xmlns="http://abc.org/abcWebServices"').getnumberval;
v_response_msg := XMLType.extract(v_response,
'/OutOfStockAdviceResponse/OutOfStockAdviceResult/Response/ResponseMessage/text()',
'xmlns="http://abc.org/abcWebServices"').getstringval;Both calls are failing with:
ORA-30625: method dispatch on NULL SELF argument is disallowedCan anybody point me in the right direction for solving this issue? Is there a way to get the xmltype.extract function to recognize the different character encoding schemes (if they do indeed actually exist)?
Any help appreciated.
CM.
PS. Apologize for the weak subject line.Chris
Since that Serviceis actually returning the escaped representation of '<' and '>' inside OutOfStocAdviceResult, the XML Parser considers that whole block of text to be simply a text node child the parent element, not valid XML. Hence the result of your XPath expressions is null and you get the ORA-30625 when you try to invoke the getNumberVal() and getStringVal() methods, which is the PL/SQL equivilant of a Java Null Pointer Exception.
You can solve it as follows...
set define off
set serveroutput on
declare
v_response xmltype;
v_response_code number(4);
v_response_msg varchar2(64);
v_xmltext varchar2(256);
v_OutOfStockResponse xmltype := xmltype(
'<OutOfStockAdviceResponse xmlns="http://abc.org/abcWebServices">
<OutOfStockAdviceResult>
& lt;Response& gt;& lt;ResponseCode& gt;0& lt;/ResponseCode& gt;& lt;ResponseMessage& gt;Successful& lt;/ResponseMessage& gt;& lt;/Response& gt;
</OutOfStockAdviceResult>
</OutOfStockAdviceResponse>');
begin
select extractValue(v_OutOfStockResponse,'/OutOfStockAdviceResponse/OutOfStockAdviceResult','xmlns="http://abc.org/abcWebServices"')
into v_xmltext
from dual;
dbms_output.put_line('Text = ' || v_xmlText);
v_response := xmltype(v_xmltext);
v_response_code := v_response.extract('/Response/ResponseCode/text()').getnumberval();
v_response_msg := v_response.extract('/Response/ResponseMessage/text()').getstringval();
dbms_output.put_line('Code = ' || v_response_code);
dbms_output.put_line('Msg = ' || v_response_msg);
end;Note that like you I had to insert space characters between in the 'lt' and 'gt' escape sequences...
When this is run you get the following
SQL> set define off
SQL> set serveroutput on
SQL> --
SQL> declare
2 v_response xmltype;
3 v_response_code number(4);
4 v_response_msg varchar2(64);
5 v_xmltext varchar2(256);
6 v_OutOfStockResponse xmltype := xmltype(
7 '<OutOfStockAdviceResponse xmlns="http://abc.org/abcWebServices">
8 <OutOfStockAdviceResult>
9 & lt;Response& gt;& lt;ResponseCode& gt;0& lt;/ResponseCode& gt;& lt;ResponseMessage& gt;Successful& lt;/ResponseMessage& gt;& lt;/Response& gt;
10 </OutOfStockAdviceResult>
11 </OutOfStockAdviceResponse>');
12 begin
13 select extractValue(v_OutOfStockResponse,'/OutOfStockAdviceResponse/OutOfStockAdviceResult','xmlns="http://abc.org/abcWebServices"')
14 into v_xmltext
15 from dual;
16 dbms_output.put_line('Text = ' || v_xmlText);
17 v_response := xmltype(v_xmltext);
18 v_response_code := v_response.extract('/Response/ResponseCode/text()').getnumberval();
19 v_response_msg := v_response.extract('/Response/ResponseMessage/text()').getstringval();
20 dbms_output.put_line('Code = ' || v_response_code);
21 dbms_output.put_line('Msg = ' || v_response_msg);
22 end;
23 /
Text =
<Response><ResponseCode>0</ResponseCode><ResponseMessage>Successful</ResponseMes
sage></Response>
Code = 0
Msg = Successful
PL/SQL procedure successfully completed.
SQL>Basically we extract the encoded text using extractValue() which will de-escape the escapted characters and then create a new XMLType which we can operate on -
Call popup, make selection, re-execute query problem
Hi all,
I searched and searched, but can't quite figure out how to do this. The javascript/AJAX examples just get me completely lost.
I have a search page. On the search page I want to allow the users to save and subsequently retrieve a search. I have the part to save search working fine. But, I am having a devil of a time getting the retrieve search functionality to work.
The popup works fine, and displays the saved searched for that user, and I can get the sequence number of the search returned back to the calling page. But, now that the calling page has the sequence number, I need to submit the page (or whatever is needed for a PPR region), so that it checks to see if the sequence number field is null or not. If it's not null, then query the saved search table to extract the query condition, plug that in to the where clause, and re-execute the query to repopulate the region.
I have a quasi-working example of what I'm trying to do at on the apex.oracle.com site at http://apex.oracle.com/pls/otn/f?p=11772:3 (if needed, the application is called "test problem", page 3). Due to how my search functionality is setup, using Oracle text, I can't get a 'real' search to perform, so I'm 'faking it' with just a "select *..." on the site.
Workspace: wbfergus
username: htmldb
password: htmldb
Any help or guidance is greatly appreciated. Thanks,
Bill FergusonWell, I've finally got it to return the SEQ from the popup onto the calling page and then have the calling page submit.
However, I now have some other kind of problem that's really vexing me. I've turned on debug so I can see how the page is getting rendered, at up near the top it explicity states:
0.01: ...Session State: Saved Item "P3_SEQ" New Value="121"
However, I have a region that is based on a PL/SQL function returning a query:
declare
v_stmnt varchar2(4000) := null;
v_where varchar2(4000) := null;
v_area varchar2(4000) := null;
begin
if :P3_SEQ IS NULL THEN
--if apex_application.get_current_flow_sgid(:P3_SEQ) IS NULL THEN
v_where := :P3_WHERE_CLAUSE;
v_area := :P3_AREA_SEARCH;
htp.p('P3_SEQ is NULL');
htp.p('');
else
SELECT where_clause, search_area
INTO v_where, v_area
FROM playlist
WHERE seq = v(':P3_SEQ');
htp.p('P3_SEQ = '||:P3_SEQ);
htp.p('');
end if;
--v_where := 'XYZ';
v_stmnt := 'SELECT dep_id, dev_st, oper_tp, sig, NAME, ';
v_stmnt := v_stmnt||'commod, commod_group, ';
v_stmnt := v_stmnt||'MIN (usgs_num) KEEP (DENSE_RANK FIRST ORDER BY mt_rec ASC) usgs_num, ';
v_stmnt := v_stmnt||'MIN (model_name) KEEP (DENSE_RANK FIRST ORDER BY mt_rec ASC) model_name, ';
v_stmnt := v_stmnt||'MIN (country) KEEP (DENSE_RANK FIRST ORDER BY l_line ASC) country, ';
v_stmnt := v_stmnt||'MIN (state_prov) KEEP (DENSE_RANK FIRST ORDER BY l_line ASC) state_prov, ';
v_stmnt := v_stmnt||'MIN (county) KEEP (DENSE_RANK FIRST ORDER BY l_line ASC) county, ';
v_stmnt := v_stmnt||'MIN (lat_dec) KEEP (DENSE_RANK FIRST ORDER BY g_line ASC) lat_dec, ';
v_stmnt := v_stmnt||'MIN (lon_dec) KEEP (DENSE_RANK FIRST ORDER BY g_line ASC) lon_dec, ';
v_stmnt := v_stmnt||'mas_id, mrds_id ';
v_stmnt := v_stmnt||'FROM NEW_MASTER_QUERY1 ';
v_stmnt := v_stmnt||'WHERE dep_id IN ';
v_stmnt := v_stmnt||' (SELECT dep_id ';
v_stmnt := v_stmnt||' FROM search_table where '||v_where||' ';
v_stmnt := v_stmnt||v_area||') ';
v_stmnt := v_stmnt||'GROUP BY dep_id, dev_st, oper_tp, sig, NAME, ';
v_stmnt := v_stmnt||'commod, commod_group, mas_id, mrds_id';
htp.p(v_stmnt);
return v_stmnt;
END;It always acts as if :P3_SEQ is null, and is confirmed by the htp.p output. But the page explicity knows that :P3_SEQ is not null.?.?
This is just on my local copy of the app, I'll see if I can put together something on apex.oracle.com that does the same thing. My default query on my app uses Oracle Text, so simulating it requires a bit of extra work.
Thanks,
Bill Ferguson -
Hello APEX people,
I posted my problem here:
Designing LOV Query Problem
What I have is a sequence like this:
CREATE SEQUENCE
DR_SEQ_FIRST_SCHEDULE_GROUP
MINVALUE 1 MAXVALUE 7 INCREMENT BY 1 START WITH 1
CACHE 6 ORDER CYCLE ;
What I need would be a SQL query returning all possible values oft my sequence like:
1
2
3
4
5
6
7
I want to use it as a source for a LOV...
The reason why I use the cycling sequence is: My app uses it to cycle scheduling priorities every month to groups identified by this number (1-7).
In the Admin Form, I want to restrict the assignment in a user friendly way - a LOV.
Thanks
JohannHere ist the solution (posted by michales in the PL/SQL forum):
SQL> CREATE SEQUENCE
dr_seq_first_schedule_group
MINVALUE 1 MAXVALUE 7 INCREMENT BY 1 START WITH 1
CACHE 6 ORDER CYCLE
Sequence created.
SQL> SELECT LEVEL sn
FROM DUAL
CONNECT BY LEVEL <= (SELECT max_value
FROM user_sequences
WHERE sequence_name = 'DR_SEQ_FIRST_SCHEDULE_GROUP')
SN
1
2
3
4
5
6
7
7 rows selected. -
Extracting SAP Query,Infoset Data from VB Application
Hi,
I need to get all SAP Queries,Infosets and SAP Query Group data from a VB application.
I have found a Remote Enabled Function called IQAPI_READ_QUERY_CATALOG.
But when I call the Function from a VB application ,the call is not successful and even I am not getting any exception.
The call is getting false with null exception .
Can anyone please guide me.
Or is there any other function module /procedure / table to extract SAP Query ,Infoset,SAP Query Group data??
Thanks in Advance.http://stackoverflow.com/questions/3765373/how-do-i-do-a-select-distinct-using-a-sap-infoset-query
-
SQL+-MULTI TABLE QUERY PROBLEM
HAI ALL,
ANY SUGGESTION PLEASE?
SUB: SQL+-MULTI TABLE QUERY PROBLEM
SQL+ QUERY GIVEN:
SELECT PATIENT_NUM, PATIENT_NAME, HMTLY_TEST_NAME, HMTLY_RBC_VALUE,
HMTLY_RBC_NORMAL_VALUE, DLC_TEST_NAME, DLC_POLYMORPHS_VALUE,
DLC_POLYMORPHS_NORMAL_VALUE FROM PATIENTS_MASTER1, HAEMATOLOGY1,
DIFFERENTIAL_LEUCOCYTE_COUNT1
WHERE PATIENT_NUM = HMTLY_PATIENT_NUM AND PATIENT_NUM = DLC_PATIENT_NUM AND PATIENT_NUM
= &PATIENT_NUM;
RESULT GOT:
&PATIENT_NUM =1
no rows selected
&PATIENT_NUM=2
no rows selected
&PATIENT_NUM=3
PATIENT_NUM 3
PATIENT_NAME KKKK
HMTLY_TEST_NAME HAEMATOLOGY
HMTLY_RBC_VALUE 4
HMTLY_RBC_NORMAL 4.6-6.0
DLC_TEST_NAME DIFFERENTIAL LEUCOCYTE COUNT
DLC_POLYMORPHS_VALUE 60
DLC_POLYMORPHS_NORMAL_VALUE 40-65
ACTUAL WILL BE:
&PATIENT_NUM=1
PATIENT_NUM 1
PATIENT_NAME BBBB
HMTLY_TEST_NAME HAEMATOLOGY
HMTLY_RBC_VALUE 5
HMTLY_RBC_NORMAL 4.6-6.0
&PATIENT_NUM=2
PATIENT_NUM 2
PATIENT_NAME GGGG
DLC_TEST_NAME DIFFERENTIAL LEUCOCYTE COUNT
DLC_POLYMORPHS_VALUE 42
DLC_POLYMORPHS_NORMAL_VALUE 40-65
&PATIENT_NUM=3
PATIENT_NUM 3
PATIENT_NAME KKKK
HMTLY_TEST_NAME HAEMATOLOGY
HMTLY_RBC_VALUE 4
HMTLY_RBC_NORMAL 4.6-6.0
DLC_TEST_NAME DIFFERENTIAL LEUCOCYTE COUNT
DLC_POLYMORPHS_VALUE 60
DLC_POLYMORPHS_NORMAL_VALUE 40-65
4 TABLES FOR CLINICAL LAB FOR INPUT DATA AND GET REPORT ONLY FOR TESTS MADE FOR PARTICULAR
PATIENT.
TABLE1:PATIENTS_MASTER1
COLUMNS:PATIENT_NUM, PATIENT_NAME,
VALUES:
PATIENT_NUM
1
2
3
4
PATIENT_NAME
BBBB
GGGG
KKKK
PPPP
TABLE2:TESTS_MASTER1
COLUMNS:TEST_NUM, TEST_NAME
VALUES:
TEST_NUM
1
2
TEST_NAME
HAEMATOLOGY
DIFFERENTIAL LEUCOCYTE COUNT
TABLE3:HAEMATOLOGY1
COLUMNS:
HMTLY_NUM,HMTLY_PATIENT_NUM,HMTLY_TEST_NAME,HMTLY_RBC_VALUE,HMTLY_RBC_NORMAL_VALUE
VALUES:
HMTLY_NUM
1
2
HMTLY_PATIENT_NUM
1
3
MTLY_TEST_NAME
HAEMATOLOGY
HAEMATOLOGY
HMTLY_RBC_VALUE
5
4
HMTLY_RBC_NORMAL_VALUE
4.6-6.0
4.6-6.0
TABLE4:DIFFERENTIAL_LEUCOCYTE_COUNT1
COLUMNS:DLC_NUM,DLC_PATIENT_NUM,DLC_TEST_NAME,DLC_POLYMORPHS_VALUE,DLC_POLYMORPHS_
NORMAL_VALUE,
VALUES:
DLC_NUM
1
2
DLC_PATIENT_NUM
2
3
DLC_TEST_NAME
DIFFERENTIAL LEUCOCYTE COUNT
DIFFERENTIAL LEUCOCYTE COUNT
DLC_POLYMORPHS_VALUE
42
60
DLC_POLYMORPHS_NORMAL_VALUE
40-65
40-65
THANKS
RCS
E-MAIL:[email protected]
--------I think you want an OUTER JOIN
SELECT PATIENT_NUM, PATIENT_NAME, HMTLY_TEST_NAME, HMTLY_RBC_VALUE,
HMTLY_RBC_NORMAL_VALUE, DLC_TEST_NAME, DLC_POLYMORPHS_VALUE,
DLC_POLYMORPHS_NORMAL_VALUE
FROM PATIENTS_MASTER1, HAEMATOLOGY1, DIFFERENTIAL_LEUCOCYTE_COUNT1
WHERE PATIENT_NUM = HMTLY_PATIENT_NUM (+)
AND PATIENT_NUM = DLC_PATIENT_NUM (+)
AND PATIENT_NUM = &PATIENT_NUM;Edited by: shoblock on Nov 5, 2008 12:17 PM
outer join marks became stupid emoticons or something. attempting to fix -
Extract Sql Query with Actual Parameters from Report
Hi
I am able to extract query from Crystal Report using the following code :
ReportDocument.ReportClientDocument.RowSetController.GetSqlStatement(new GroupPath, out tmp);
But the sql query retrieve comes in the following format :
select name , trans_code, account_code from command_query.accounts
where account_code = {?Command_query_Prompt0} and effective_date < '{?Command_query_prompt1 }'
The parameters which I m using in the reports are :
Account_Code and Effective_Date .
Why does my extracted sql translates it into {?Command_query_Prompt0} and '{?Command_query_prompt1 }' .
Is there any way to map this to the actual parameter values ?
OR
Can we extract the query after assigning the values ?
Any help is appreciated ...
Thanks
Sanchethi,
You can create nested sql query with conditional parameters,
For example
Select Code From OITT Where Code IN (Select ItemCode From OITM
Where ItemName LIKE '[%0]' + '%%')
Edited by: Jeyakanthan A on Jun 9, 2009 12:31 PM -
Extract BI Query data into a file
Guys,
I need to extract BI Query Data to a csv or a flat file and place it in Application Server.
I tried using RSCRM_BAPI, but i get a pop-up message "Invalid file path".
Any help would be highly appreciated.
thanks, RaviHi,
Give correct Path in Application Server Use AL11 to see the path, take authorizations on AL11 and set it.
https://websmp103.sap-ag.de/~sapdownload/011000358700004400232004E/HowToRSCRM_BAPI.pdf
Re: Running Quaries automatically and saving them in as a Excel file in Server
Re: Data transfer to external systems
Re: Loading from a Custom R/3 Table
Re: How can I schedule my Bex report to execute in background
Re: How can I insert the RSCRM_BAPI into Process chain?
Thanks
Reddy -
XMLType extract method does not work if namespace attribute values are included
In the example below, only the second row returns an ID from the extract function. The presence of an xmlns attribute appears to be the cause.
SQL> drop table configs;
Table dropped.
Elapsed: 00:00:03.06
SQL>
SQL> create table configs (xml_data sys.xmltype);
Table created.
Elapsed: 00:00:00.02
SQL>
SQL> create index configs on configs (xml_data) indextype is ctxsys.context;
Index created.
Elapsed: 00:00:02.01
SQL>
SQL> insert into configs values(sys.xmltype.createxml('<config
2 xmlns="http://www.ourcompanykscl.com/configuration">
3 <dataformat
4 name="F1" description="format spec" id="14082" version="2"
5 status="started" deployed="true" lastModifiedBy="bloggsj" lastModifiedDate="2002-05-10T09:44:45">
6 <F11Format>
7 <SpecificationFilename>c:/formats/F1.txt</SpecificationFilename>
8 </F11Format>
9 </dataformat></config>'
10 ))
11 /
1 row created.
Elapsed: 00:00:01.02
SQL>
SQL> insert into configs values(sys.xmltype.createxml('<config>
2 <dataformat
3 name="F1" description="format spec" id="14082" version="2"
4 status="started" deployed="true" lastModifiedBy="bloggsj" lastModifiedDate="2002-05-10T09:44:45">
5 <F11Format>
6 <SpecificationFilename>c:/formats/F1.txt</SpecificationFilename>
7 </F11Format>
8 </dataformat>
9 </config>'
10 ))
11 /
1 row created.
Elapsed: 00:00:00.00
SQL>
SQL> BEGIN
2 ctx_ddl.sync_index('configs');
3 END;
4 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.02
SQL>
SQL> SELECT c.xml_data.extract('//dataformat/@id').getstringval(), c.xml_data.getstringval()
2 FROM configs c
3 WHERE CONTAINS(c.xml_data, '14082 INPATH (//dataformat/@id)') > 0
4 /
C.XML_DATA.EXTRACT('//DATAFORMAT/@ID').GETSTRINGVAL()
C.XML_DATA.GETSTRINGVAL()
<config
xmlns="http://www.ourcompanykscl.com/configuration">
<dataformat
name="F1" description="format spec" id="14082" version="2"
status="started" deployed="true" lastModifiedBy="bloggsj" lastModifiedDa
te="2002-05-10T09:44:45">
<F11Format>
<SpecificationFilename>c:/formats/F1.txt</SpecificationFilename>
</F11Format>
</dataformat></config>
14082
<config>
<dataformat
name="F1" description="format spec" id="14082" version="2"
status="started" deployed="true" lastModifiedBy="bloggsj" lastModifiedDa
te="2002-05-10T09:44:45">
<F11Format>
<SpecificationFilename>c:/formats/F1.txt</SpecificationFilename>
</F11Format>
</dataformat>
</config>
Elapsed: 00:00:00.03Hi Amarnath,
Thanks for looking into my issue.
When I started writing the dynamic custom approver group, I did not use FND_NUMBER and it didnt work. After that I checked it in the AME Implementation Guide which says
"Queries for number and currency attributes must select the number or currency
amount converted to a varchar2 by:
fnd_number.number_to_canonical"
So that should not be a problem.
Please correct me if I am wrong but Now I see two different possibilities :
1. The seeded variable :transactionId which is being passed to the query is not able to get the value. In other words, the transactionId is not being passed.
2. I am using wrong Attributes to identify the transaction which is being used in the Condition and that condition is used in a Rule. In this case, I am trying to identify that the Basic Person details are changed and I am using seeded attribute HR_IS_PERSON_BASIC_DETAILS_CHANGE_SS in condition.
Any feedback?
Appreciate all replies.
Thanks,
CAH -
Query Problem Oracle9i Release 9.2.0.7.0
Hello,
I need help with this one. I have xml file like this:
<?xml version="1.0" ?>
- <TecKomBS xmlns="http://www.bsi.si" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bsi.si http://www.bsi.si/_data/tecajnice/TecKomBS-l.xsd">
- <tecajnica datum="2006-12-29" veljavnost="2007-01-01">
- <tecaj oznaka="GBP" sifra="826">
<nakupni>0.67251</nakupni>
<prodajni>0.67049</prodajni>
</tecaj>
- <tecaj oznaka="CZK" sifra="203">
<nakupni>27.526</nakupni>
<prodajni>27.444</prodajni>
</tecaj>
- <tecaj oznaka="NOK" sifra="578">
<nakupni>8.2504</nakupni>
<prodajni>8.2256</prodajni>
</tecaj>
- <tecaj oznaka="SEK" sifra="752">
<nakupni>9.0540</nakupni>
<prodajni>9.0268</prodajni>
</tecaj>
- <tecaj oznaka="JPY" sifra="392">
<nakupni>157.17</nakupni>
<prodajni>156.69</prodajni>
</tecaj>
- <tecaj oznaka="HUF" sifra="348">
<nakupni>252.15</nakupni>
<prodajni>251.39</prodajni>
</tecaj>
- <tecaj oznaka="AUD" sifra="036">
<nakupni>1.6716</nakupni>
<prodajni>1.6666</prodajni>
</tecaj>
- <tecaj oznaka="CAD" sifra="124">
<nakupni>1.5304</nakupni>
<prodajni>1.5258</prodajni>
</tecaj>
- <tecaj oznaka="SKK" sifra="703">
<nakupni>34.487</nakupni>
<prodajni>34.383</prodajni>
</tecaj>
- <tecaj oznaka="PLN" sifra="985">
<nakupni>3.8367</nakupni>
<prodajni>3.8253</prodajni>
</tecaj>
- <tecaj oznaka="DKK" sifra="208">
<nakupni>7.4672</nakupni>
<prodajni>7.4448</prodajni>
</tecaj>
- <tecaj oznaka="HRK" sifra="191">
<nakupni>7.3614</nakupni>
<prodajni>7.3394</prodajni>
</tecaj>
- <tecaj oznaka="USD" sifra="840">
<nakupni>1.319</nakupni>
<prodajni>1.315</prodajni>
</tecaj>
- <tecaj oznaka="CHF" sifra="756">
<nakupni>1.6093</nakupni>
<prodajni>1.6045</prodajni>
</tecaj>
</tecajnica>
- <tecajnica datum="2007-01-02" veljavnost="2007-01-03">
- <tecaj oznaka="GBP" sifra="826">
<nakupni>0.67451</nakupni>
<prodajni>0.67249</prodajni>
</tecaj>
- <tecaj oznaka="CZK" sifra="203">
<nakupni>27.566</nakupni>
<prodajni>27.484</prodajni>
</tecaj>
- <tecaj oznaka="NOK" sifra="578">
<nakupni>8.2203</nakupni>
<prodajni>8.1957</prodajni>
</tecaj>
- <tecaj oznaka="SEK" sifra="752">
<nakupni>9.038</nakupni>
<prodajni>9.011</prodajni>
</tecaj>
- <tecaj oznaka="JPY" sifra="392">
<nakupni>158.000</nakupni>
<prodajni>157.520</prodajni>
</tecaj>
- <tecaj oznaka="HUF" sifra="348">
<nakupni>251.82</nakupni>
<prodajni>251.06</prodajni>
</tecaj>
- <tecaj oznaka="AUD" sifra="036">
<nakupni>1.6719</nakupni>
<prodajni>1.6669</prodajni>
</tecaj>
- <tecaj oznaka="CAD" sifra="124">
<nakupni>1.5475</nakupni>
<prodajni>1.5429</prodajni>
</tecaj>
- <tecaj oznaka="SKK" sifra="703">
<nakupni>34.435</nakupni>
<prodajni>34.331</prodajni>
</tecaj>
- <tecaj oznaka="PLN" sifra="985">
<nakupni>3.8344</nakupni>
<prodajni>3.8230</prodajni>
</tecaj>
- <tecaj oznaka="DKK" sifra="208">
<nakupni>7.4678</nakupni>
<prodajni>7.4454</prodajni>
</tecaj>
- <tecaj oznaka="HRK" sifra="191">
<nakupni>7.3735</nakupni>
<prodajni>7.3515</prodajni>
</tecaj>
- <tecaj oznaka="USD" sifra="840">
<nakupni>1.329</nakupni>
<prodajni>1.325</prodajni>
</tecaj>
- <tecaj oznaka="CHF" sifra="756">
<nakupni>1.6128</nakupni>
<prodajni>1.6080</prodajni>
</tecaj>
</tecajnica>
+ <tecajnica datum="2007-01-03" veljavnost="2007-01-04">
+ <tecajnica datum="2007-01-04" veljavnost="2007-01-05">
+ <tecajnica datum="2007-01-05" veljavnost="2007-01-06">
+ <tecajnica datum="2007-01-08" veljavnost="2007-01-09">
+ <tecajnica datum="2007-01-09" veljavnost="2007-01-10">
under every "tecajnica" from witch I want to get "datum" as date I have more data,
first "tecaj" from witch I want to get "sifra" and under "tecaj" first I have "nakupni" from witch I want to get value of "nakupni" and second I have "prodajni" from witch I want to get value of "prodajni".
So the data I want would look like this:
For every "datum" I want "sifra", "nakupni" and "prodajni"
If I have in my xml file only one "datum" for "tecajnica" this is not a problem, I get this with this query:
SELECT
extractValue(Value(d), 'tecajnica/.@datum','xmlns="http://www.bsi.si"') datum,
extractValue(VALUE(p), 'tecaj/.@sifra','xmlns="http://www.bsi.si"') sval,
extractValue(VALUE(p), 'tecaj/nakupni','xmlns="http://www.bsi.si"') nakupni,
extractValue(VALUE(p), 'tecaj/prodajni','xmlns="http://www.bsi.si"') prodajni
FROM
Xml_tab x,
TABLE(XMLSequence(extract(x.xml, '/TecKomBS/tecajnica','xmlns="http://www.bsi.si"'))) d,
TABLE(XMLSequence(extract(x.xml, '/TecKomBS/tecajnica/*','xmlns="http://www.bsi.si"'))) p
but if I have xml file like example on top (with more dates), I get mix of all data in the xml file. So I get alot of wrong data!
I have tried some examples with Xqery but I gues I am doing something wrong.
Can you pleeease help me ?
Thanks for your time
JI have tried also this, but I get error that doesn't mean nothing:
select xmlquery('for $i in $d/TecKomBS/Tecajnica where $i/.@datum eq
"2006-01-26" return $d/TecKomBS/Tecajnica/.@datum'
passing t.XML as "d" returning content)
from Xml_tab t
I get this:
SQL> /
passing t.XML as "d" returning content)
ERROR at line 2:
ORA-00907: missing right parenthesis
Can you help me please ? -
ExtractValue-namespace problem?
hi
extract(value(x),'//owl:Ontology') extracts the node, but the result of
extractValue(value(x),'//owl:Ontology//rdfs:label') is empty. I tried different way but without any success.
Any idea what can be the problem?
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#">
<owl:Ontology>
<rdfs:comment>An example OWL ontology</rdfs:comment>
<rdfs:comment>Derived from the DAML Wine ontology at
http://ontolingua.stanford.edu/doc/chimaera/ontologies/wines.daml
Substantially changed, in particular the Region based relations.
</rdfs:comment>
<rdfs:label>Wine Ontology</rdfs:label>
</owl:Ontology>
</rdf:RDF>Problem solved.
Thanks,
See: Re: extractvalue and Xpath -
I want to have a user input information into a text box and use the information to query my xmltype column (Oracle 11g) to extract data from a few of the tags and generate a report. From what I can tell APEX query builders for generating reports do not allow you to use xmltype columns. Is there another way to do this? I can write xml queries in SQL but I don’t know how to take the results and make a report in APEX. Does anyone know how to do this? Thanks!
Wrong forum.. queries using contains should be posted in the oracle text forum..
-
HI
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<HelloWorldResponse xmlns="http://tempuri.org/">
<HelloWorldResult>Oracle</HelloWorldResult>
</HelloWorldResponse>
</soap:Body>
</soap:Envelope>
please how could i extract the word "oracle" from HelloWorldResult tag?
Thanks in advanceHi,
You can use extractValue() function.
Or, if you're using version 11g, Oracle recommends using XMLQuery() instead :
DECLARE
xmldoc xmltype := xmltype(
'<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<HelloWorldResponse xmlns="http://tempuri.org/">
<HelloWorldResult>Oracle</HelloWorldResult>
</HelloWorldResponse>
</soap:Body>
</soap:Envelope>');
res varchar2(30);
BEGIN
-- version <= 10.2
select extractvalue( xmldoc
, '/soap:Envelope/soap:Body/ns0:HelloWorldResponse/ns0:HelloWorldResult'
, 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/", xmlns:ns0="http://tempuri.org/"' )
into res
from dual;
dbms_output.put_line(res);
-- version >= 11.1
select xmlcast(
xmlquery(
'declare namespace soap="http://schemas.xmlsoap.org/soap/envelope/"; (::)
declare namespace ns0="http://tempuri.org/"; (::)
/soap:Envelope/soap:Body/ns0:HelloWorldResponse/ns0:HelloWorldResult'
passing xmldoc
returning content
as varchar2(30)
into res
from dual;
dbms_output.put_line(res);
END;
/ -
Reg: Query Problem for New Posting Period
Hi Xperts,
While I try to Map the A/P Invoices with their respective Outgoing Payment,
I used the following Query and it's Query Printlayout
SELECT T0.DocNum [Payment#], T0.DocDate [Payment Date],
T0.CardCode, T0.CardName, T1.InvoiceId, T2.DocNum [AP Inv#],
T2.NumatCard [Bill No.], T2.DocDate [Bill Date], T1.selfInv,
T1.SumApplied, T1.WtAppld, T0.NoDocsum
FROM [dbo].[OVPM] T0 INNER JOIN
[dbo].[VPM2] T1 ON T1.[DocNum] = T0.DocNum
INNER JOIN [dbo].[OPCH] T2 ON T2.[DocEntry] = T1.DocEntry
WHERE T0.Cardname='[%0]' and T0.DocDate='[%1]' and
T0.DocNum='[%2]'
I got the above query from our Expert Mr.Sambath only.
Now what is the problem is the query is retrieving the payment details of old Posting Period only and not the current posting period.
In detail, I used 'Primary' Series for FY08-09, Period indicator 'Default'
Now I'm using 'Primary1' Series for FY09-10, Period indicator '0910'
Thanx in adv.
Regards,
BalaHi Bala,
Looking at your query, it is not query issue ,it is your data issue.
Please check if you have data in VPM2 table which is bank transfer payment method
Thank you
Bishal
Edited by: Bishal Adhikari on Apr 9, 2009 8:48 AM -
Hi Greg,
I had created a view on a table which doesn't have Primary Key, but it has Unique and Not Null constraints on required columns.
I had wrote a procedure to query the data on VIEW. I have experienced strange problem, very first call to procedure will take more time than succeeding requests. For example from second request onwards, it returns data in < 2 Sec, but first transaction is taking 12 Sec to 30 Sec.
I thought that very first time VIEW is taking time to refresh it self. So, I added FORCE keyword in CREATE VIEW stattement. However, that doesn't helped out.
In my further investigation I came to know that base table on which VIEW created, has to be loaded in to memory before querying on VIEW.
So, I had executed a simple select statement on base table, before I execute VIEW query in procedure.
With this change I got results consistently < 2 Sec all the times.
My question is instead of executing the select statement on base table is there a way to load base tables data in memory before querying on VIEW?
Thanks,
SubbaraoHi,
A view is nothing but parsed SQL statements stored in the database, a view may or may not run faster. If you execute the SQL used to define the view how much time is it taking. If you want try looking at MATERIALIZED VIEW , that may help you.
thanks
Maybe you are looking for
-
Delivery Completed Indicator(ELIKZ:0COMPL_DEL) in 2LIS_02_SCL
Hi Experts, I am using the datasource 2LIS_02_SCL for Purchasing reports and this extractor has the 'Delivery Completed Indicator'[ELIKZ] which is mapped to 0COMPL_DEL in BW. The ODS which in our system has the 0PROCESSKEY as one of the key fields. H
-
Hi, I am trying to enable an existing database using the OCS 10.1.2 installer on HP-UX 11i. The Oracle database I want to run it against is of a higher version and it is a 10.2.0.2.0. Can someone please tell me if there is a work around? Thanks!
-
I want to use ITC Avant Garde Gothic Book in Indesign. It's showing in Font Book and it's used in an Illustrator file but isn't recognised in Indesign. I'm trying to open an ID file which has the font in it but get a Missing Fonts message with a Find
-
HT2240 May I use the same registration code on all the computers in my home
May I use the same registration code for QuickTime 7 on my additional computers in my home
-
Mail - cannot read mail - crashes, Mail - cannot read mail - crashes
Mail - am unable to read messages - Mail version 5.3 - LION 10.7.5 MACOSX - HELP PLEASE