Retrieve XML Data in clob type
I have a table created as below
create table tab123( x clob);
Inserted a row as below
insert into t values ('"<ProcessBatchRequest xmlns:inp1="http://services.abc.com/" ServiceVersionNumber="" xmlns="http://services.abc.com/GlobalBatchServiceV1.0">
<inp1:BatchDetail>
<inp1:ApplicationID>test.123</inp1:ApplicationID>
<inp1:ApplicationBatchID>test.123</inp1:ApplicationBatchID>
<inp1:MessageTimeStamp>2012-11-28T11:05:32.000-05:00</inp1:MessageTimeStamp>
</inp1:BatchDetail>
<inp1:CustomerIdentityDetail>
<inp1:SubscriberNumber>123</inp1:SubscriberNumber>
<inp1:UserUniqueID>1542</inp1:UserUniqueID>
<inp1:SubscriberCountryISOAlpha2Code>AD</inp1:SubscriberCountryISOAlpha2Code>
<inp1:ApplicationCustomerID>1210</inp1:ApplicationCustomerID>
<inp1:ApplicationCustomerName>ABC</inp1:ApplicationCustomerName>
<inp1:ApplicationUserID>ABC</inp1:ApplicationUserID>
</inp1:CustomerIdentityDetail>
<inp1:BatchSpecification>
<inp1:BatchProcessID>Clean</inp1:BatchProcessID>
<inp1:BatchPriorityValue>10</inp1:BatchPriorityValue>
<inp1:LanguagePreferenceCode>39</inp1:LanguagePreferenceCode>
<inp1:CharacterSetPreferenceCode>23423</inp1:CharacterSetPreferenceCode>
<inp1:MatchSpecification>
<inp1:ConfidenceLowerLevelThresholdValue>8</inp1:ConfidenceLowerLevelThresholdValue>
<inp1:ConfidenceFallbackLowerLevelThresholdValue>4</inp1:ConfidenceFallbackLowerLevelThresholdValue>
<inp1:ReturnAllFallbackMatchCandidatesIndicator>false</inp1:ReturnAllFallbackMatchCandidatesIndicator>
<inp1:ExclusionCriteria>
<inp1:ExclusionDataDescription>Small</inp1:ExclusionDataDescription>
</inp1:ExclusionCriteria>
<inp1:ReturnCleansedInformationIndicator>false</inp1:ReturnCleansedInformationIndicator>
<inp1:MatchOnSeniorPrincipalNameIndicator>0</inp1:MatchOnSeniorPrincipalNameIndicator>
</inp1:MatchSpecification>
<inp1:CleanseSpecification>
<inp1:ParseOnlyIndicator>0</inp1:ParseOnlyIndicator>
<inp1:ProcessAsDiscreteDataIndicator>1</inp1:ProcessAsDiscreteDataIndicator>
<inp1:ReturnDatainMixedCaseIndicator>0</inp1:ReturnDatainMixedCaseIndicator>
<inp1:DoNotReturnChangeOfAddressIndicator>1</inp1:DoNotReturnChangeOfAddressIndicator>
<inp1:DoNotEnableDeliveryPointValidationIndicator>1</inp1:DoNotEnableDeliveryPointValidationIndicator>
<inp1:DoNotReturnEnhancedLineofTravelIndicator>1</inp1:DoNotReturnEnhancedLineofTravelIndicator>
<inp1:DoNotConvertRuralRouteToStreetAddressIndicator>1</inp1:DoNotConvertRuralRouteToStreetAddressIndicator>
<inp1:DoNotReturnSuiteAddressDetailIndicator>1</inp1:DoNotReturnSuiteAddressDetailIndicator>
</inp1:CleanseSpecification>
</inp1:BatchSpecification>
<inp1:InputDetail>
<inp1:InputFileDetail>
<inp1:FileURI>/mnt/auto/</inp1:FileURI>
<inp1:FileLayoutName>Clean</inp1:FileLayoutName>
<inp1:LanguageCode>36</inp1:LanguageCode>
<inp1:CompressTypeValue>None</inp1:CompressTypeValue>
<inp1:RecordsCount>5</inp1:RecordsCount>
</inp1:InputFileDetail>
</inp1:InputDetail>
<inp1:OutputSpecification>
<inp1:FileLocationURI>/mnt/auto/</inp1:FileLocationURI>
</inp1:OutputSpecification>
<inp1:NotificationDetail>
<inp1:NotificationMethodValue>Test</inp1:NotificationMethodValue>
<inp1:NotificationFrequencyValue>0</inp1:NotificationFrequencyValue>
</inp1:NotificationDetail>
<inp1:BatchReferenceDetail/>
</ProcessBatchRequest>
1 rows inserted.
Now i want to retrieve the value present under a given xpath. Can anyone help with the query???
Not sure why you're storing double quotes around your XML text.
Anyway, here's a starting point for you...
SQL> ed
Wrote file afiedt.buf
1 with t as (select '"<ProcessBatchRequest xmlns:inp1="http://services.abc.com/" ServiceVersionNumber="" xmlns="http://services.abc.com/GlobalBatchServiceV1.0">
2 <inp1:BatchDetail>
3 <inp1:ApplicationID>test.123</inp1:ApplicationID>
4 <inp1:ApplicationBatchID>test.123</inp1:ApplicationBatchID>
5 <inp1:MessageTimeStamp>2012-11-28T11:05:32.000-05:00</inp1:MessageTimeStamp>
6 </inp1:BatchDetail>
7 <inp1:CustomerIdentityDetail>
8 <inp1:SubscriberNumber>123</inp1:SubscriberNumber>
9 <inp1:UserUniqueID>1542</inp1:UserUniqueID>
10 <inp1:SubscriberCountryISOAlpha2Code>AD</inp1:SubscriberCountryISOAlpha2Code>
11 <inp1:ApplicationCustomerID>1210</inp1:ApplicationCustomerID>
12 <inp1:ApplicationCustomerName>ABC</inp1:ApplicationCustomerName>
13 <inp1:ApplicationUserID>ABC</inp1:ApplicationUserID>
14 </inp1:CustomerIdentityDetail>
15 <inp1:BatchSpecification>
16 <inp1:BatchProcessID>Clean</inp1:BatchProcessID>
17 <inp1:BatchPriorityValue>10</inp1:BatchPriorityValue>
18 <inp1:LanguagePreferenceCode>39</inp1:LanguagePreferenceCode>
19 <inp1:CharacterSetPreferenceCode>23423</inp1:CharacterSetPreferenceCode>
20 <inp1:MatchSpecification>
21 <inp1:ConfidenceLowerLevelThresholdValue>8</inp1:ConfidenceLowerLevelThresholdValue>
22 <inp1:ConfidenceFallbackLowerLevelThresholdValue>4</inp1:ConfidenceFallbackLowerLevelThresholdValue>
23 <inp1:ReturnAllFallbackMatchCandidatesIndicator>false</inp1:ReturnAllFallbackMatchCandidatesIndicator>
24 <inp1:ExclusionCriteria>
25 <inp1:ExclusionDataDescription>Small</inp1:ExclusionDataDescription>
26 </inp1:ExclusionCriteria>
27 <inp1:ReturnCleansedInformationIndicator>false</inp1:ReturnCleansedInformationIndicator>
28 <inp1:MatchOnSeniorPrincipalNameIndicator>0</inp1:MatchOnSeniorPrincipalNameIndicator>
29 </inp1:MatchSpecification>
30 <inp1:CleanseSpecification>
31 <inp1:ParseOnlyIndicator>0</inp1:ParseOnlyIndicator>
32 <inp1:ProcessAsDiscreteDataIndicator>1</inp1:ProcessAsDiscreteDataIndicator>
33 <inp1:ReturnDatainMixedCaseIndicator>0</inp1:ReturnDatainMixedCaseIndicator>
34 <inp1:DoNotReturnChangeOfAddressIndicator>1</inp1:DoNotReturnChangeOfAddressIndicator>
35 <inp1:DoNotEnableDeliveryPointValidationIndicator>1</inp1:DoNotEnableDeliveryPointValidationIndicator>
36 <inp1:DoNotReturnEnhancedLineofTravelIndicator>1</inp1:DoNotReturnEnhancedLineofTravelIndicator>
37 <inp1:DoNotConvertRuralRouteToStreetAddressIndicator>1</inp1:DoNotConvertRuralRouteToStreetAddressIndicator>
38 <inp1:DoNotReturnSuiteAddressDetailIndicator>1</inp1:DoNotReturnSuiteAddressDetailIndicator>
39 </inp1:CleanseSpecification>
40 </inp1:BatchSpecification>
41 <inp1:InputDetail>
42 <inp1:InputFileDetail>
43 <inp1:FileURI>/mnt/auto/</inp1:FileURI>
44 <inp1:FileLayoutName>Clean</inp1:FileLayoutName>
45 <inp1:LanguageCode>36</inp1:LanguageCode>
46 <inp1:CompressTypeValue>None</inp1:CompressTypeValue>
47 <inp1:RecordsCount>5</inp1:RecordsCount>
48 </inp1:InputFileDetail>
49 </inp1:InputDetail>
50 <inp1:OutputSpecification>
51 <inp1:FileLocationURI>/mnt/auto/</inp1:FileLocationURI>
52 </inp1:OutputSpecification>
53 <inp1:NotificationDetail>
54 <inp1:NotificationMethodValue>Test</inp1:NotificationMethodValue>
55 <inp1:NotificationFrequencyValue>0</inp1:NotificationFrequencyValue>
56 </inp1:NotificationDetail>
57 <inp1:BatchReferenceDetail/>
58 </ProcessBatchRequest>"' as xml_clob from dual)
59 --
60 -- end of test data
61 --
62 select b.*, c.*
63 from t
64 ,xmltable(xmlnamespaces(default 'http://services.abc.com/GlobalBatchServiceV1.0', 'http://services.abc.com/' as "inp1"),
65 '/ProcessBatchRequest'
66 passing xmltype(trim('"' from xml_clob))
67 columns BD XMLTYPE path './inp1:BatchDetail'
68 ,CID XMLTYPE path './inp1:CustomerIdentityDetail'
69 ,BS XMLTYPE path './inp1:BatchSpecification'
70 ,ID XMLTYPE path './inp1:InputDetail'
71 ,OS XMLTYPE path './inp1:OutputSpecification'
72 ) a
73 ,xmltable(xmlnamespaces(default 'http://services.abc.com/GlobalBatchServiceV1.0', 'http://services.abc.com/' as "inp1"),
74 '/inp1:BatchDetail'
75 passing a.BD
76 columns App_ID varchar2(10) path './inp1:ApplicationID'
77 ,AppBat_ID varchar2(10) path './inp1:ApplicationBatchID'
78 ,MsgTS varchar2(30) path './inp1:MessageTimeStamp'
79 ) b
80 ,xmltable(xmlnamespaces(default 'http://services.abc.com/GlobalBatchServiceV1.0', 'http://services.abc.com/' as "inp1"),
81 '/inp1:CustomerIdentityDetail'
82 passing a.CID
83 columns Sub_No number path './inp1:SubscriberNumber'
84 ,UUID number path './inp1:UserUniqueID'
85 ,Sub_Country varchar2(2) path './inp1:SubscriberCountryISOAlpha2Code'
86 ,App_Cust_ID number path './inp1:ApplicationCustomerID'
87 ,App_Cust_Nm varchar2(10) path './inp1:ApplicationCustomerName'
88 ,App_User_ID varchar2(10) path './inp1:ApplicationUserID'
89* ) c
SQL> /
APP_ID APPBAT_ID MSGTS SUB_NO UUID SU APP_CUST_ID APP_CUST_N APP_USER_I
test.123 test.123 2012-11-28T11:05:32.000-05:00 123 1542 AD 1210 ABC ABC
SQL>
{code}
Similar Messages
-
Storing XML data in CLOB and relational tables
I would like to ask whether there is a possibility to store XML data using normal relational tables and CLOBs in the same time. For example I have some XML data (structured data) which I would like update very often and some which are only a kind of description. I found something about it in http://technet.oracle.com/tech/xml/infoocs/otnwp/about_oracle_xml_products.htm . But I do not know how to use Oracle8i views and some functionality of XML SQL Utility to retrieve XML data in one file.
null<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Maciej Marczukajtis ([email protected]):
I would like to ask whether there is a possibility to store XML data using normal relational tables and CLOBs in the same time. For example I have some XML data (structured data) which I would like update very often and some which are only a kind of description. I found something about it in http://technet.oracle.com/tech/xml/infoocs/otnwp/about_oracle_xml_products.htm . But I do not know how to use Oracle8i views and some functionality of XML SQL Utility to retrieve XML data in one file.<HR></BLOCKQUOTE>
Czesc Maciek,
There are some good examples with XSQL Servlet. From what I understand you have one XML file and you need to save a portion of document in relational tables and other portion in CLOB.
Yes, you can do that.
You can do it many ways. I can suggest (2).
1. Use the views
2. call your java procedure that will do
the xml processing, brake it down and insert
releval frogments into different tables/columns
null -
Retrieve xml data from a relational table(oracle) with datatype as xmltyp
Hello Avijit, any resolution for this issue?
hi .... I am trying to retrieve xml data from a relational table with datatype as xmltyp. The SQ is retrieving rows but the xml parser give transformation error . The transformation retrieve xml data from a relational table(oracle) with datatype as xmltyp returned a row error status on receiving an input row on group retrieve xml data from a relational table(oracle) with datatype as xmltyp. ERROR : An XML document was truncated and thus not processed. Input row from SQ_XMLTYPE_TEST: Rowdata: ( RowType=0(insert) Src Rowid=5 Targ Rowid=5 DOCUMENT (DataInput:Char.64000:): "<?xml version='1.0' encoding='UTF-8'?><main><DATA_RECORD> <OFFER_ID>434345</OFFER_ID> <ADDR>sec -2 salt lake</ADDR> <CITY>kolkata</CITY> (DISPLAY TRUNCATED)(TRUNCATED)" ) thanks in advance Avijit
-
Hi,
I have a table with xml_data in long raw form , i am converting the data in long raw to clob this process is working fine .
but later i need to make changes to the xml_data in the clob , when the xml data is small the changes occur but in case of huge xml data the process gets hanged . I am using dbms_lob.instr , dbms_lob.substr function and a procedure for replace as there is not built in dbms_lob.replace function.....
can anyone plzzzzzzzzz help me out with the same.......... its urgent
Message was edited by:
user500620Thank you, Kamal. I am learning as I going along with the project : )
I do understand the examples that you have provided me with.
This is the table structure I query against. (table name audit_v3)
(column : adt_xml_desc CLOB )
select to_char(
substr(a.adt_xml_desc,
INSTR(a.adt_xml_desc, '<CONTACT_HISTORY>',1,1),
INSTR(a.adt_xml_desc, '</CONTACT_HISTORY>',1,1)-INSTR(a.adt_xml_desc, '<CONTACT_HISTORY>',1,1)+18 )
from audit_v3 a
where a.adt_id = 7397337;
The result that I get = <CONTACT_HISTORY><USER><USER_ID>W951FVK</USER_ID><FIRST_NAME>Krishna</FIRST_NAME><LAST_NAME>Rajamani</LAST_NAME></USER><CONSUMER><CONS_SEQ_NBR>0</CONS_SEQ_NBR></CONSUMER></CONTACT_HISTORY>
Now I want to store it in a varchar2 variable and then pass it to the xmltype to get individual data values. This is where I am having issue with.
1. Do I store the value above in a varchar2?
2. Can I pass the variable into the xmltype?
Thank you very much, Kamal.
declare
xml xmltype ;
test1 varchar2(1000);
begin
select to_char(v.adt_xml_desc) into test1 from audit_v3 v where v.adt_id = 7397337;
xml := xmltype('''' ||test1||'''');
/* xml := xmltype('<EVENT>
<SWTSUPDATE TYPE="1">
<MEMBERID>9822598</MEMBERID>
<DATETIME>Fri Jun 09 14:51:33 CDT 2006</DATETIME>
<USERID>W951FVK</USERID>
</SWTSUPDATE>
<CONTACT_HISTORY>
<USER>
<USER_ID>W951FVK</USER_ID>
<FIRST_NAME>Krishna</FIRST_NAME>
<LAST_NAME>Rajamani</LAST_NAME>
</USER>
<CONSUMER>
<CONS_SEQ_NBR>1387445</CONS_SEQ_NBR>
<FIRST_NAME>SPRINGHOUSE</FIRST_NAME>
<LAST_NAME>ELLIS</LAST_NAME>
</CONSUMER>
</CONTACT_HISTORY>
</EVENT>') ;
dbms_output.put_line(xml.extract('/EVENT/CONTACT_HISTORY/USER/LAST_NAME/text()').getStringVal()) ;
end ; -
Retrieve XML stored in CLOB as columns
Hi,
I have the below table that holds XML in a CLOB
CREATE TABLE testxml
(idcol NUMBER(3), xml_data CLOB
INSERT
INTO testxml VALUES
201,
<TRADE>
<TRADETYPE>SWAP</TRADETYPE>
<SUBTYPE>CDS</SUBTYPE>
<TRADEHEADER>
<ACTION>NEW</ACTION>
<SOURCEID>ABS-CD</SOURCEID>
<TRADEID>20595896</TRADEID>
</TRADEHEADER>
<TRADELEGS>
<TRADELEG>
<PAY_OR_RECEIVE>P</PAY_OR_RECEIVE>
<FIXED_FLOAT_IND>FLT</FIXED_FLOAT_IND>
<DAY_COUNT_BASIS>A365F</DAY_COUNT_BASIS>
<ORIG_PRIMARY_CURRENCY>ZAR</ORIG_PRIMARY_CURRENCY>
<FIRST_VALUE_DATE>20120511</FIRST_VALUE_DATE>
</TRADELEG>
<TRADELEG>
<PAY_OR_RECEIVE>R</PAY_OR_RECEIVE>
<FIXED_FLOAT_IND>FIX</FIXED_FLOAT_IND>
<DAY_COUNT_BASIS>A365F</DAY_COUNT_BASIS>
<ORIG_PRIMARY_CURRENCY>ZAR</ORIG_PRIMARY_CURRENCY>
<FIRST_VALUE_DATE>20120511</FIRST_VALUE_DATE>
</TRADELEG>
</TRADELEGS>
<PVS>
<PV_SOURCE>ABS-CD</PV_SOURCE>
<PV>
<NPV>0</NPV>
<NPV_CCY>ZAR</NPV_CCY>
<VALUATION_DATE>20130628</VALUATION_DATE>
<LEG_NUMBER>1</LEG_NUMBER>
</PV>
<PV>
<NPV>2214864.54</NPV>
<NPV_CCY>ZAR</NPV_CCY>
<VALUATION_DATE>20130628</VALUATION_DATE>
<LEG_NUMBER>2</LEG_NUMBER>
</PV>
</PVS>
<CREDIT_DERIVATIVES>
<CREDIT_DERIVATIVE>
<NOMINAL>100000000</NOMINAL>
<MATURITY_DATE>20170620</MATURITY_DATE>
<BUY_SELL_INDICATOR>SELL</BUY_SELL_INDICATOR>
<CURRENCY>ZAR</CURRENCY>
</CREDIT_DERIVATIVE>
<CREDIT_DERIVATIVE>
<NOMINAL>100002000</NOMINAL>
<MATURITY_DATE>20170620</MATURITY_DATE>
<BUY_SELL_INDICATOR>BUY</BUY_SELL_INDICATOR>
<CURRENCY>USD</CURRENCY>
</CREDIT_DERIVATIVE>
</CREDIT_DERIVATIVES>
</TRADE>
I need the data to be retrieved as columns. I have tried the below SQL but it works for one XMLTable i.e. TRADELEGS. But If I try to use another XMLTable for PVS then it does a cartesian join.
SELECT id,
xmltype(xml_data).extract('/TRADE/TRADETYPE/text()').getStringVal() AS TRADETYPE,
xmltype(xml_data).extract('/TRADE/SUBTYPE/text()').getStringVal() AS SUBTYPE,
xmltype(xml_data).extract('/TRADE/TRADEHEADER/ACTION/text()').getStringVal() AS ACTION,
x.PAY_OR_RECEIVE,
x.FIXED_FLOAT_IND
FROM testxml,
XMLTable( '/TRADE/TRADELEGS/TRADELEG' passing XMLTYPE(xml_data)
columns
PAY_OR_RECEIVE VARCHAR2(20) PATH 'PAY_OR_RECEIVE'
, FIXED_FLOAT_IND VARCHAR2(20) PATH 'FIXED_FLOAT_IND' ) x;
The below query does not work:
SELECT id,
xmltype(xml_data).extract('/TRADE/TRADETYPE/text()').getStringVal() AS TRADETYPE,
xmltype(xml_data).extract('/TRADE/SUBTYPE/text()').getStringVal() AS SUBTYPE,
xmltype(xml_data).extract('/TRADE/TRADEHEADER/ACTION/text()').getStringVal() AS ACTION,
tradeleg.PAY_OR_RECEIVE,
tradeleg.FIXED_FLOAT_IND
,xmltype(xml_data).extract('/TRADE/PVS/PV_SOURCE/text()').getStringVal() AS PV_SOURCE
,pvs.npv,
pvs.VALUATION_DATE
FROM testxml,
XMLTable( '/TRADE/TRADELEGS/TRADELEG' passing XMLTYPE(xml_data)
columns
PAY_OR_RECEIVE VARCHAR2(1) PATH 'PAY_OR_RECEIVE'
, FIXED_FLOAT_IND VARCHAR2(3) PATH 'FIXED_FLOAT_IND' ) tradeleg
,XMLTable( '/TRADE/PVS/PV' passing XMLTYPE(xml_data)
columns
NPV NUMBER PATH 'NPV'
, VALUATION_DATE VARCHAR2(8) PATH 'VALUATION_DATE' ) pvs
WHERE id = 1;
I need the output for TRADELEGS, PVS and CREDIT_DERIVATIVES.
Regards,
VikramBut If I try to use another XMLTable for PVS then it does a cartesian join.
Of course it does. You have to use a join condition of some kind.
What's the correlation between TRADELEGS, PVS and CREDIT_DERIVATIVES?
I guess you can relate a PV to a TRADELEG via the LEG_NUMBER, right? But what about CREDIT_DERIVATIVE to PV or to TRADELEG?
I need the output for TRADELEGS, PVS and CREDIT_DERIVATIVES.
Explain what that output should look like. -
Hi,
I'm very new in Oracle. I have DB running on oracle 9i. On production DB one tablespace have CLOB datatype and this CLOB field have all techinal stuff stored in XML format. How DO I fetch this info?
select info from infotbl; showing all the XML junk.
what is the batter way to fetch XML data properlyDifficult to give the exact answer without knowing which node repeats..
Howver it will be something like this
select extractValue(value(x),'/RepeatingNode/NonRepatingNode/NonRepeatingNode)
from TABLE, table(xmlsequence(extract(xmltype(clob),'/Root/Node/RepeatingNode')))) x -
How to retreive soap xml data from clob column in a table
Hi,
I am trying to retrieve the XML tag value from clob column.
Table name = xyz and column= abc (clob datatype)
data stored in abc column is as below
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:head="http://www.abc.com/gcgi/shared/system/header" xmlns:v6="http://www.abc.com/gcgi/services/v6_0_0_0" xmlns:sys="http://www.abc.com/gcgi/shared/system/systemtypes">
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<RqHeader soapenv:mustUnderstand="0" xmlns="http://www.abc.com/gcgi/shared/system/header">
<DateAndTimeStamp>2011-12-20T16:02:36.677+08:00</DateAndTimeStamp>
<UUID>1000002932</UUID>
<Version>6_0_0_0</Version>
<ClientDetails>
<Org>ABC</Org>
<OrgUnit>ABC</OrgUnit>
<ChannelID>HBK</ChannelID>
<TerminalID>0000</TerminalID>
<SrcCountryCode>SG</SrcCountryCode>
<DestCountryCode>SG</DestCountryCode>
<UserGroup>HBK</UserGroup>
</ClientDetails>
</RqHeader>
<wsa:Action>/SvcImpl/bank/
SOAPEndpoint/AlertsService.serviceagent/OpEndpointHTTP/AlertDeleteInq</wsa:Action></soapenv:Header>
<soapenv:Body>
<v6:AlertDeleteInqRq>
<v6:Base>
<v6:VID>20071209013112</v6:VID>
<!--Optional:-->
<v6:Ref>CTAA00000002644</v6:Ref>
</v6:Base>
</v6:AlertDeleteInqRq>
</soapenv:Body>
</soapenv:Envelope>
And i want to retrieve the values of tag
<ChannelID> and <v6:VID>
can somebody help, i have tried with extractvalue but not able to get the valuesI have used the below two queries but not able to get the expected results. Both queries result into no values.
select xmltype(MED_REQ_PAYLOAD).extract('//ClientDetails/Org','xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" || xmlns="http://www.abc.com/gcgi/shared/system/header"').getStringValue() from ESB_OUTPUT_TEMP where SOAPACTION = '/SvcImpl/bank/alerts/v6_0_0_0/SOAPEndpoint/AlertsService.serviceagent/OpEndpointHTTP/AlertDeleteInq'
select EXTRACTVALUE(xmltype(MED_REQ_PAYLOAD),'/RqHeader/) from ESB_OUTPUT_TEMP where SOAPACTION = '/SvcImpl/bank/SOAPEndpoint/AlertsService.serviceagent/OpEndpointHTTP/AlertDeleteInq'
Well, for starters, both queries are syntactically wrong :
- non terminated string
- incorrect namespace mapping declaration
- unknown XMLType method "getStringValue()"
Secondly, all those functions are deprecated now.
Here's an up-to-date example using XMLTable. It will retrieve the two tag values you mentioned :
SQL> select x.*
2 from esb_output_temp t
3 , xmltable(
4 xmlnamespaces(
5 'http://schemas.xmlsoap.org/soap/envelope/' as "soap"
6 , 'http://www.abc.com/gcgi/shared/system/header' as "head"
7 , 'http://www.abc.com/gcgi/services/v6_0_0_0' as "v6"
8 )
9 , '/soap:Envelope'
10 passing xmlparse(document t.med_req_payload)
11 columns ChannelID varchar2(10) path 'soap:Header/head:RqHeader/head:ClientDetails/head:ChannelID'
12 , VID varchar2(30) path 'soap:Body/v6:AlertDeleteInqRq/v6:Base/v6:VID'
13 ) x
14 ;
CHANNELID VID
HBK 20071209013112
You may also want to store XML in XMLType columns for both performance and storage optimizations. -
Hi Guys,
I wonder if you can help me out , I m trying to insert a XML stored in a CLOB column as an XMLTYPE.. the example at eh end works but when i add in the sSELCT statement I get eh following error...
INSERT INTO tmp_xml_table VALUES
(11, 'select data from tmp_requests where id = 159');
SQL Error: ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00210: expected '<' instead of 's'
Error at line 1
31011. 00000 - "XML parsing failed"
*Cause: XML parser returned an error while trying to parse the document.
*Action: Check if the document to be parsed is valid.
DESC tmp_xml_table
Name Null Type
ID NUMBER
DATA XMLTYPE()
this bit works....
INSERT INTO myTable VALUES (1, SYS.XMLType.CreateXML(
'<?xml version="1.0"?>
<fall>
<name>myTable</name>
<county>USA</county>
<state>MI</state>
<url>
http://your.com
</url>
</fall>'));You are trying to insert the literal string 'select data from tmp_requests where id = 159', which is not valid XML.
Try:
insert into tmp_xml_table
select 11, data from tmp_requests where id=159; -
Help for retrieve xml data from database.
Hello friends,
I am inserting xml file into oracle database.
column name is xyz_xml and data type is XMLType.
I have successfully inserted that.
But My problem is How can i retrieve that xml file from database and can view in explorer as a text.
If any one have any idea than let me know.
ThanksHello Friend...!
I am getting the following error and i am not figure out this error :
NosuchfieldException : conversionPlease Help me. -
Query xml data from a CLOB datatye
All,
I read in an oracle white paper that is is possible to query XML data from CLOB datatype using oracle text index using operators HASPATH() and INPATH(). I am not able to find any example on how to do this. Can someone please post a simple example here.
Thank You very much!SCOTT@10gXE> CREATE TABLE your_table (id NUMBER, xml_data CLOB)
2 /
Table created.
SCOTT@10gXE> INSERT INTO your_table (id, xml_data)
2 SELECT t.deptno,
3 DBMS_XMLGEN.GETXML
4 ('SELECT d.dname,
5 CURSOR (SELECT e.ename, e.job
6 FROM emp e
7 WHERE e.deptno = d.deptno) emp_data
8 FROM dept d
9 WHERE d.deptno = ' || t.deptno)
10 FROM dept t
11 /
5 rows created.
SCOTT@10gXE> COMMIT
2 /
Commit complete.
SCOTT@10gXE> begin
2 ctx_ddl.create_section_group('xmlpathgroup', 'PATH_SECTION_GROUP');
3 end;
4 /
PL/SQL procedure successfully completed.
SCOTT@10gXE> CREATE INDEX myindex
2 ON your_table(xml_data)
3 INDEXTYPE IS ctxsys.context
4 PARAMETERS ('datastore ctxsys.default_datastore
5 filter ctxsys.null_filter
6 section group xmlpathgroup'
7 )
8 /
Index created.
SCOTT@10gXE> SELECT * FROM your_table
2 WHERE CONTAINS (xml_data, 'PERSONNEL INPATH (//DNAME)') > 0
3 /
ID XML_DATA
50 <?xml version="1.0"?>
<ROWSET>
<ROW>
<DNAME>PERSONNEL</DNAME>
<EMP_DATA>
</EMP_DATA>
</ROW>
</ROWSET>
SCOTT@10gXE> SELECT * FROM your_table
2 WHERE CONTAINS (xml_data, 'HASPATH (//DNAME="PERSONNEL")') > 0
3 /
ID XML_DATA
50 <?xml version="1.0"?>
<ROWSET>
<ROW>
<DNAME>PERSONNEL</DNAME>
<EMP_DATA>
</EMP_DATA>
</ROW>
</ROWSET>
SCOTT@10gXE> SELECT * FROM your_table
2 WHERE CONTAINS (xml_data, 'CLARK INPATH (//ENAME)') > 0
3 /
ID XML_DATA
10 <?xml version="1.0"?>
<ROWSET>
<ROW>
<DNAME>ACCOUNTING</DNAME>
<EMP_DATA>
<EMP_DATA_ROW>
<ENAME>CLARK</ENAME>
<JOB>MANAGER</JOB>
</EMP_DATA_ROW>
<EMP_DATA_ROW>
<ENAME>KING</ENAME>
<JOB>PRESIDENT</JOB>
</EMP_DATA_ROW>
<EMP_DATA_ROW>
<ENAME>MILLER</ENAME>
<JOB>CLERK</JOB>
</EMP_DATA_ROW>
</EMP_DATA>
</ROW>
</ROWSET>
SCOTT@10gXE> SELECT * FROM your_table
2 WHERE CONTAINS (xml_data, 'HASPATH (//ENAME="CLARK")') > 0
3 /
ID XML_DATA
10 <?xml version="1.0"?>
<ROWSET>
<ROW>
<DNAME>ACCOUNTING</DNAME>
<EMP_DATA>
<EMP_DATA_ROW>
<ENAME>CLARK</ENAME>
<JOB>MANAGER</JOB>
</EMP_DATA_ROW>
<EMP_DATA_ROW>
<ENAME>KING</ENAME>
<JOB>PRESIDENT</JOB>
</EMP_DATA_ROW>
<EMP_DATA_ROW>
<ENAME>MILLER</ENAME>
<JOB>CLERK</JOB>
</EMP_DATA_ROW>
</EMP_DATA>
</ROW>
</ROWSET>
SCOTT@10gXE> -
Passing XML in CLOB and processing data from CLOB
Hi All,
I am facing problem when trying to access xml data from CLOB.
My stored procedure is as below:
CREATE OR REPLACE PROCEDURE usp_XMLTEST2
in_XmlDoc IN CLOB
IS
BEGIN
UPDATE XML_TEST
SET SETFLAG='N'
WHERE (ITEMCODE,WAREHOUSE) IN
SELECT
TO_NUMBER(EXTRACT(COLUMN_VALUE,'//Entry/@ItemCode')) ,
TO_NUMBER(EXTRACT(COLUMN_VALUE,'//Entry/@Warehouse'))
FROM TABLE(XMLSEQUENCE( EXTRACT(XMLTYPE(in_XmlDoc), '//List/*' )))
END usp_XMLTEST2;
Exec usp_XMLTEST2('<List Daemon="2"><Entry ItemCode="112333" Warehouse="4101" /><Entry ItemCode="112333" Warehouse="4103" /></List>');
It gives error:
ERROR at line 1:
ORA-22905: cannot access rows from a non-nested table item
ORA-06512: at "PUBLIX.USP_XMLTEST2", line 8
ORA-06512: at line 1
Please devise solution to this problem.
Regards
Nitin BajajTry casting it:
SELECT TO_NUMBER(EXTRACT(COLUMN_VALUE,'//Entry/@ItemCode'))
TO_NUMBER(EXTRACT(COLUMN_VALUE,'//Entry/@Warehouse'))
FROM TABLE(cast( XMLSEQUENCE( EXTRACT(XMLTYPE(in_XmlDoc), '//List/*' )) as XMLSequenceType ) )
Anton -
Parse a xml file from clob column.
Dear,
i have been suffreing a problem about xml.
i have a table with two columns, one is bfile data type other is clob data type. A xml data is stored into both cloumns
as clob and bfile. My xml data format is correct.
when i took xml data from bfile column, then dbms_xmlparser.parseClob successfully parse my xml data.
Code below:
=======================================
dbms_lob.createtemporary(l_clob, cache=>FALSE);
dbms_lob.loadFromFile(dest_lob => l_clob,
src_lob => l_bfile,
amount => dbms_lob.getLength(l_bfile));
l_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(l_parser, l_clob); ========================================
But when i took xml data form clob clumn directly, then dbms_xmlparser.parseClob parse failed and go to exception.
Code below:
====================================================================
dbms_lob.createtemporary(l_clob, cache=>FALSE);
select xml_cfile,xml_bfile
into l_clob ,l_bfile
from xml_load_in
l_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(l_parser, l_clob); --failed parse
====================================================================
declare
l_bfile BFILE;
l_clob CLOB;
l_parser dbms_xmlparser.Parser;
l_doc dbms_xmldom.DOMDocument;
begin
dbms_lob.createtemporary(l_clob, cache=>FALSE);
select xml_cfile,xml_bfile
into l_clob ,l_bfile
from xml_load_in
l_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(l_parser, l_clob);
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
exception
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
dbms_xmldom.freeDocument(l_doc);
End;
Example:
======--File_name := Outward.xml;
CREATE OR REPLACE DIRECTORY
MY_INWARD AS
'D:\PBM\Inward\';
CREATE TABLE XML_LOAD_IN
( XML_CFILE CLOB,
XML_BFILE BFILE
INSERT INTO XML_LOAD_IN ( XML_CFILE, XML_BFILE )
VALUES (
'<?xml version="1.0" encoding="UTF-8"?>
<BACPSInterface>
<OCE>
<EHR>
<StandardLevel>03</StandardLevel>
<TestFiledIndicator>T</TestFiledIndicator>
<ImmediateDestRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</ImmediateDestRoutingNumber>
<ImmediateOriginRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</ImmediateOriginRoutingNumber>
<FileCreationDate>20090714</FileCreationDate>
<FileCreationTime>1047</FileCreationTime>
<ResendIndicator>N</ResendIndicator>
<ECESettlementDate>20090714</ECESettlementDate>
<ECESessionTime>1047</ECESessionTime>
<ECESettlementTime>1047</ECESettlementTime>
<ECEtype>01</ECEtype>
<CountryCode>BD</CountryCode>
</EHR>
<Collection>
<CHR>
<CashLetterBusinessDate>20090714</CashLetterBusinessDate>
<CashLetterCreationDate>20090714</CashLetterCreationDate>
<CashLetterCreationTime>1047</CashLetterCreationTime>
<CashLetterRecordTypeInd>I</CashLetterRecordTypeInd>
<CashLetterDocTypeIndicator>G</CashLetterDocTypeIndicator>
<CashLetterID>1</CashLetterID>
<OriginatorContactName>Bank Asia</OriginatorContactName>
<OriginatorContactPhoneNumber>XXX</OriginatorContactPhoneNumber>
</CHR>
<ForwardBundle>
<BHR>
<CollectionTypeIndicator>I</CollectionTypeIndicator>
<DestRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</DestRoutingNumber>
<ECEInstitutionRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</ECEInstitutionRoutingNumber>
<BundleBusinessDate>20090714</BundleBusinessDate>
<BundleCreationDate>20090714</BundleCreationDate>
<BundleID>1</BundleID>
<ReturnLocationRoutingNumber>070127538</ReturnLocationRoutingNumber>
</BHR>
<CDR>
<CDR num="1">
<ECESettlementDate>20090714</ECESettlementDate>
<ECESessionTime>1047</ECESessionTime>
<ECESettlementTime>1047</ECESettlementTime>
<ECEItemType>N</ECEItemType>
<IssuingBranchRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</IssuingBranchRoutingNumber>
<AccountNumber>0000334008221</AccountNumber>
<ChequeSequenceNumber>1601735</ChequeSequenceNumber>
<ItemAmount>500</ItemAmount>
<ECEInstitutionItemSequencNum>0701275380000001</ECEInstitutionItemSequencNum>
<DocumentationTypeIndicator>I</DocumentationTypeIndicator>
<ReturnAcceptanceIndicator>6</ReturnAcceptanceIndicator>
<MICRValidIndicator>1</MICRValidIndicator>
<BOFDIndicator>Y</BOFDIndicator>
<ChequeDetailRecAddendumCount>0</ChequeDetailRecAddendumCount>
<CorrectionIndicator>0</CorrectionIndicator>
<RepresentmentIndicator>0</RepresentmentIndicator>
<ArchiveTypeIndicator>F</ArchiveTypeIndicator>
</CDR>
<CDR num="2">
<ECESettlementDate>20090714</ECESettlementDate>
<ECESessionTime>1047</ECESessionTime>
<ECESettlementTime>1047</ECESettlementTime>
<ECEItemType>N</ECEItemType>
<IssuingBranchRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</IssuingBranchRoutingNumber>
<AccountNumber>0000345682256</AccountNumber>
<ChequeSequenceNumber>1234567</ChequeSequenceNumber>
<ItemAmount>1000</ItemAmount>
<ECEInstitutionItemSequencNum>0701275380000002</ECEInstitutionItemSequencNum>
<DocumentationTypeIndicator>I</DocumentationTypeIndicator>
<ReturnAcceptanceIndicator>6</ReturnAcceptanceIndicator>
<MICRValidIndicator>1</MICRValidIndicator>
<BOFDIndicator>Y</BOFDIndicator>
<ChequeDetailRecAddendumCount>0</ChequeDetailRecAddendumCount>
<CorrectionIndicator>0</CorrectionIndicator>
<RepresentmentIndicator>0</RepresentmentIndicator>
<ArchiveTypeIndicator>F</ArchiveTypeIndicator>
</CDR>
</CDR>
<CDA>
<CDA num="1">
<AddendumRecordNumber>1</AddendumRecordNumber>
<BOFDRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>75</DistrictCode>
<BranchCode>12</BranchCode>
<CheckDigit>8</CheckDigit>
</BOFDRoutingNumber>
<BOFDBusinessEndorsementDate>20090714</BOFDBusinessEndorsementDate>
<BOFDDepositAccountNumber>0000334008221</BOFDDepositAccountNumber>
<BOFDDepositBranch>753</BOFDDepositBranch>
<PayeeName>XXX</PayeeName>
<TruncationIndicator>Y</TruncationIndicator>
<BOFDConversionIndicator>2</BOFDConversionIndicator>
<BOFDCorrectionIndicator>0</BOFDCorrectionIndicator>
</CDA>
<CDA num="2">
<AddendumRecordNumber>1</AddendumRecordNumber>
<BOFDRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>75</DistrictCode>
<BranchCode>12</BranchCode>
<CheckDigit>8</CheckDigit>
</BOFDRoutingNumber>
<BOFDBusinessEndorsementDate>20090714</BOFDBusinessEndorsementDate>
<BOFDDepositAccountNumber>0000345682256</BOFDDepositAccountNumber>
<BOFDDepositBranch>753</BOFDDepositBranch>
<PayeeName>XXX</PayeeName>
<TruncationIndicator>Y</TruncationIndicator>
<BOFDConversionIndicator>2</BOFDConversionIndicator>
<BOFDCorrectionIndicator>0</BOFDCorrectionIndicator>
</CDA>
</CDA>
<CDC>
<CDC num="1">
<AddendumCRecordNumber>1</AddendumCRecordNumber>
<EndorsingBankRountingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</EndorsingBankRountingNumber>
<EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
<EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
<EndorsingBankItemSequenceNum>0701275380000001</EndorsingBankItemSequenceNum>
<TruncationIndicator>Y</TruncationIndicator>
<EndorsingBankConversionInd>2</EndorsingBankConversionInd>
<EndorsingBankCorrectionInd>0</EndorsingBankCorrectionInd>
</CDC>
<CDC num="2">
<AddendumCRecordNumber>1</AddendumCRecordNumber>
<EndorsingBankRountingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</EndorsingBankRountingNumber>
<EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
<EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
<EndorsingBankItemSequenceNum>0701275380000002</EndorsingBankItemSequenceNum>
<TruncationIndicator>Y</TruncationIndicator>
<EndorsingBankConversionInd>2</EndorsingBankConversionInd>
<EndorsingBankCorrectionInd>0</EndorsingBankCorrectionInd>
</CDC>
</CDC>
<IVD>
<IVD num="1">
<ImageIndicator>1</ImageIndicator>
<ImageCreatorRountingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</ImageCreatorRountingNumber>
<ImageCreatorDate>20090714</ImageCreatorDate>
<ImageViewFormatIndicator>0</ImageViewFormatIndicator>
<ImageViewCompressionAlg>0</ImageViewCompressionAlg>
<ViewSideIndicator>0</ViewSideIndicator>
<ViewDescriptor>0</ViewDescriptor>
<DigitalSignatureIndicator>1</DigitalSignatureIndicator>
<DigitalSignatureMethod>0</DigitalSignatureMethod>
<SecurityKeySize>12235</SecurityKeySize>
<ImageRecreateIndicator>0</ImageRecreateIndicator>
</IVD>
<IVD num="2">
<ImageIndicator>1</ImageIndicator>
<ImageCreatorRountingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</ImageCreatorRountingNumber>
<ImageCreatorDate>20090714</ImageCreatorDate>
<ImageViewFormatIndicator>0</ImageViewFormatIndicator>
<ImageViewCompressionAlg>0</ImageViewCompressionAlg>
<ViewSideIndicator>0</ViewSideIndicator>
<ViewDescriptor>0</ViewDescriptor>
<DigitalSignatureIndicator>1</DigitalSignatureIndicator>
<DigitalSignatureMethod>0</DigitalSignatureMethod>
<SecurityKeySize>12235</SecurityKeySize>
<ImageRecreateIndicator>0</ImageRecreateIndicator>
</IVD>
</IVD>
<IVT>
<IVT num="1">
<ECEInstitutionRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</ECEInstitutionRoutingNumber>
<BundleBusinessDate>20090714</BundleBusinessDate>
<CycleNumber>0</CycleNumber>
<ECEInstitutionItemSeqNumber>0701275380000001</ECEInstitutionItemSeqNumber>
<ClippingOrigin>
<Origin>0</Origin>
<CoordinateH1>0000</CoordinateH1>
<CoordinateH2>0000</CoordinateH2>
<CoordinateV1>0000</CoordinateV1>
<CoordinateV2>0000</CoordinateV2>
</ClippingOrigin>
<LengthofImageReferenceKey>0</LengthofImageReferenceKey>
<LengthofDigitalSignature>0</LengthofDigitalSignature>
<LengthofImageData>1</LengthofImageData>
<OffsetToImageData>01001000</OffsetToImageData>
</IVT>
<IVT num="2">
<ECEInstitutionRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</ECEInstitutionRoutingNumber>
<BundleBusinessDate>20090714</BundleBusinessDate>
<CycleNumber>0</CycleNumber>
<ECEInstitutionItemSeqNumber>0701275380000002</ECEInstitutionItemSeqNumber>
<ClippingOrigin>
<Origin>0</Origin>
<CoordinateH1>0000</CoordinateH1>
<CoordinateH2>0000</CoordinateH2>
<CoordinateV1>0000</CoordinateV1>
<CoordinateV2>0000</CoordinateV2>
</ClippingOrigin>
<LengthofImageReferenceKey>0</LengthofImageReferenceKey>
<LengthofDigitalSignature>0</LengthofDigitalSignature>
<LengthofImageData>1</LengthofImageData>
<OffsetToImageData>01001000</OffsetToImageData>
</IVT>
</IVT>
<IVA>
<IVA num="1">
<GlobalImageQuality>0</GlobalImageQuality>
<GlobalImageUsability>1</GlobalImageUsability>
<ImagingBankSpecificTest>1</ImagingBankSpecificTest>
</IVA>
<IVA num="2">
<GlobalImageQuality>0</GlobalImageQuality>
<GlobalImageUsability>1</GlobalImageUsability>
<ImagingBankSpecificTest>1</ImagingBankSpecificTest>
</IVA>
</IVA>
<BCR>
<ItemsWithinBundleCount>2</ItemsWithinBundleCount>
<BundleTotalAmount>1500</BundleTotalAmount>
<MICRValidTotalAmount>1500</MICRValidTotalAmount>
</BCR>
</ForwardBundle>
<CCR>
<BundleCount>1</BundleCount>
<ItemWithinCashLetterCount>2</ItemWithinCashLetterCount>
<CashLetterTotalAmount>1500</CashLetterTotalAmount>
<ImagesWithinCashLetterCount>2</ImagesWithinCashLetterCount>
<ECEInstitutionName>Bank Asia</ECEInstitutionName>
<SettlementDate>20090714</SettlementDate>
</CCR>
</Collection>
<ECR>
<CashLetterCount>1</CashLetterCount>
<TotalRecordCount>2</TotalRecordCount>
<TotalItemCount>2</TotalItemCount>
<FileTotalAmount>1500</FileTotalAmount>
<ImmediateOriginContactName>Bank Asia</ImmediateOriginContactName>
<ImmediateOriginContactNumber>XXX</ImmediateOriginContactNumber>
</ECR>
</OCE>
</BACPSInterface>'
, BFILENAME('MY_INWARD','Outward.xml'));
COMMIT;What version of Oracle (4 digits) and what is the error?
This runs without error on 10.2.0.4 (though you can go directly from a CLOB to a DOMDocument via dbms_xmldom)
-- Created on 9/14/2009 by JH20567
declare
-- Local variables here
l_clob CLOB;
l_parser dbms_xmlparser.Parser;
l_doc dbms_xmldom.DOMDocument;
begin
-- Test statements here
l_clob := '<?xml version="1.0" encoding="UTF-8"?>
<BACPSInterface>
<OCE>
<EHR>
<StandardLevel>03</StandardLevel>
<TestFiledIndicator>T</TestFiledIndicator>
<ImmediateDestRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</ImmediateDestRoutingNumber>
<ImmediateOriginRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</ImmediateOriginRoutingNumber>
<FileCreationDate>20090714</FileCreationDate>
<FileCreationTime>1047</FileCreationTime>
<ResendIndicator>N</ResendIndicator>
<ECESettlementDate>20090714</ECESettlementDate>
<ECESessionTime>1047</ECESessionTime>
<ECESettlementTime>1047</ECESettlementTime>
<ECEtype>01</ECEtype>
<CountryCode>BD</CountryCode>
</EHR>
<Collection>
<CHR>
<CashLetterBusinessDate>20090714</CashLetterBusinessDate>
<CashLetterCreationDate>20090714</CashLetterCreationDate>
<CashLetterCreationTime>1047</CashLetterCreationTime>
<CashLetterRecordTypeInd>I</CashLetterRecordTypeInd>
<CashLetterDocTypeIndicator>G</CashLetterDocTypeIndicator>
<CashLetterID>1</CashLetterID>
<OriginatorContactName>Bank Asia</OriginatorContactName>
<OriginatorContactPhoneNumber>XXX</OriginatorContactPhoneNumber>
</CHR>
<ForwardBundle>
<BHR>
<CollectionTypeIndicator>I</CollectionTypeIndicator>
<DestRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</DestRoutingNumber>
<ECEInstitutionRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</ECEInstitutionRoutingNumber>
<BundleBusinessDate>20090714</BundleBusinessDate>
<BundleCreationDate>20090714</BundleCreationDate>
<BundleID>1</BundleID>
<ReturnLocationRoutingNumber>070127538</ReturnLocationRoutingNumber>
</BHR>
<CDR>
<CDR num="1">
<ECESettlementDate>20090714</ECESettlementDate>
<ECESessionTime>1047</ECESessionTime>
<ECESettlementTime>1047</ECESettlementTime>
<ECEItemType>N</ECEItemType>
<IssuingBranchRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</IssuingBranchRoutingNumber>
<AccountNumber>0000334008221</AccountNumber>
<ChequeSequenceNumber>1601735</ChequeSequenceNumber>
<ItemAmount>500</ItemAmount>
<ECEInstitutionItemSequencNum>0701275380000001</ECEInstitutionItemSequencNum>
<DocumentationTypeIndicator>I</DocumentationTypeIndicator>
<ReturnAcceptanceIndicator>6</ReturnAcceptanceIndicator>
<MICRValidIndicator>1</MICRValidIndicator>
<BOFDIndicator>Y</BOFDIndicator>
<ChequeDetailRecAddendumCount>0</ChequeDetailRecAddendumCount>
<CorrectionIndicator>0</CorrectionIndicator>
<RepresentmentIndicator>0</RepresentmentIndicator>
<ArchiveTypeIndicator>F</ArchiveTypeIndicator>
</CDR>
<CDR num="2">
<ECESettlementDate>20090714</ECESettlementDate>
<ECESessionTime>1047</ECESessionTime>
<ECESettlementTime>1047</ECESettlementTime>
<ECEItemType>N</ECEItemType>
<IssuingBranchRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</IssuingBranchRoutingNumber>
<AccountNumber>0000345682256</AccountNumber>
<ChequeSequenceNumber>1234567</ChequeSequenceNumber>
<ItemAmount>1000</ItemAmount>
<ECEInstitutionItemSequencNum>0701275380000002</ECEInstitutionItemSequencNum>
<DocumentationTypeIndicator>I</DocumentationTypeIndicator>
<ReturnAcceptanceIndicator>6</ReturnAcceptanceIndicator>
<MICRValidIndicator>1</MICRValidIndicator>
<BOFDIndicator>Y</BOFDIndicator>
<ChequeDetailRecAddendumCount>0</ChequeDetailRecAddendumCount>
<CorrectionIndicator>0</CorrectionIndicator>
<RepresentmentIndicator>0</RepresentmentIndicator>
<ArchiveTypeIndicator>F</ArchiveTypeIndicator>
</CDR>
</CDR>
<CDA>
<CDA num="1">
<AddendumRecordNumber>1</AddendumRecordNumber>
<BOFDRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>75</DistrictCode>
<BranchCode>12</BranchCode>
<CheckDigit>8</CheckDigit>
</BOFDRoutingNumber>
<BOFDBusinessEndorsementDate>20090714</BOFDBusinessEndorsementDate>
<BOFDDepositAccountNumber>0000334008221</BOFDDepositAccountNumber>
<BOFDDepositBranch>753</BOFDDepositBranch>
<PayeeName>XXX</PayeeName>
<TruncationIndicator>Y</TruncationIndicator>
<BOFDConversionIndicator>2</BOFDConversionIndicator>
<BOFDCorrectionIndicator>0</BOFDCorrectionIndicator>
</CDA>
<CDA num="2">
<AddendumRecordNumber>1</AddendumRecordNumber>
<BOFDRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>75</DistrictCode>
<BranchCode>12</BranchCode>
<CheckDigit>8</CheckDigit>
</BOFDRoutingNumber>
<BOFDBusinessEndorsementDate>20090714</BOFDBusinessEndorsementDate>
<BOFDDepositAccountNumber>0000345682256</BOFDDepositAccountNumber>
<BOFDDepositBranch>753</BOFDDepositBranch>
<PayeeName>XXX</PayeeName>
<TruncationIndicator>Y</TruncationIndicator>
<BOFDConversionIndicator>2</BOFDConversionIndicator>
<BOFDCorrectionIndicator>0</BOFDCorrectionIndicator>
</CDA>
</CDA>
<CDC>
<CDC num="1">
<AddendumCRecordNumber>1</AddendumCRecordNumber>
<EndorsingBankRountingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</EndorsingBankRountingNumber>
<EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
<EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
<EndorsingBankItemSequenceNum>0701275380000001</EndorsingBankItemSequenceNum>
<TruncationIndicator>Y</TruncationIndicator>
<EndorsingBankConversionInd>2</EndorsingBankConversionInd>
<EndorsingBankCorrectionInd>0</EndorsingBankCorrectionInd>
</CDC>
<CDC num="2">
<AddendumCRecordNumber>1</AddendumCRecordNumber>
<EndorsingBankRountingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</EndorsingBankRountingNumber>
<EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
<EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
<EndorsingBankItemSequenceNum>0701275380000002</EndorsingBankItemSequenceNum>
<TruncationIndicator>Y</TruncationIndicator>
<EndorsingBankConversionInd>2</EndorsingBankConversionInd>
<EndorsingBankCorrectionInd>0</EndorsingBankCorrectionInd>
</CDC>
</CDC>
<IVD>
<IVD num="1">
<ImageIndicator>1</ImageIndicator>
<ImageCreatorRountingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</ImageCreatorRountingNumber>
<ImageCreatorDate>20090714</ImageCreatorDate>
<ImageViewFormatIndicator>0</ImageViewFormatIndicator>
<ImageViewCompressionAlg>0</ImageViewCompressionAlg>
<ViewSideIndicator>0</ViewSideIndicator>
<ViewDescriptor>0</ViewDescriptor>
<DigitalSignatureIndicator>1</DigitalSignatureIndicator>
<DigitalSignatureMethod>0</DigitalSignatureMethod>
<SecurityKeySize>12235</SecurityKeySize>
<ImageRecreateIndicator>0</ImageRecreateIndicator>
</IVD>
<IVD num="2">
<ImageIndicator>1</ImageIndicator>
<ImageCreatorRountingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</ImageCreatorRountingNumber>
<ImageCreatorDate>20090714</ImageCreatorDate>
<ImageViewFormatIndicator>0</ImageViewFormatIndicator>
<ImageViewCompressionAlg>0</ImageViewCompressionAlg>
<ViewSideIndicator>0</ViewSideIndicator>
<ViewDescriptor>0</ViewDescriptor>
<DigitalSignatureIndicator>1</DigitalSignatureIndicator>
<DigitalSignatureMethod>0</DigitalSignatureMethod>
<SecurityKeySize>12235</SecurityKeySize>
<ImageRecreateIndicator>0</ImageRecreateIndicator>
</IVD>
</IVD>
<IVT>
<IVT num="1">
<ECEInstitutionRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</ECEInstitutionRoutingNumber>
<BundleBusinessDate>20090714</BundleBusinessDate>
<CycleNumber>0</CycleNumber>
<ECEInstitutionItemSeqNumber>0701275380000001</ECEInstitutionItemSeqNumber>
<ClippingOrigin>
<Origin>0</Origin>
<CoordinateH1>0000</CoordinateH1>
<CoordinateH2>0000</CoordinateH2>
<CoordinateV1>0000</CoordinateV1>
<CoordinateV2>0000</CoordinateV2>
</ClippingOrigin>
<LengthofImageReferenceKey>0</LengthofImageReferenceKey>
<LengthofDigitalSignature>0</LengthofDigitalSignature>
<LengthofImageData>1</LengthofImageData>
<OffsetToImageData>01001000</OffsetToImageData>
</IVT>
<IVT num="2">
<ECEInstitutionRoutingNumber>
<BankCode>070</BankCode>
<DistrictCode>12</DistrictCode>
<BranchCode>75</BranchCode>
<CheckDigit>8</CheckDigit>
</ECEInstitutionRoutingNumber>
<BundleBusinessDate>20090714</BundleBusinessDate>
<CycleNumber>0</CycleNumber>
<ECEInstitutionItemSeqNumber>0701275380000002</ECEInstitutionItemSeqNumber>
<ClippingOrigin>
<Origin>0</Origin>
<CoordinateH1>0000</CoordinateH1>
<CoordinateH2>0000</CoordinateH2>
<CoordinateV1>0000</CoordinateV1>
<CoordinateV2>0000</CoordinateV2>
</ClippingOrigin>
<LengthofImageReferenceKey>0</LengthofImageReferenceKey>
<LengthofDigitalSignature>0</LengthofDigitalSignature>
<LengthofImageData>1</LengthofImageData>
<OffsetToImageData>01001000</OffsetToImageData>
</IVT>
</IVT>
<IVA>
<IVA num="1">
<GlobalImageQuality>0</GlobalImageQuality>
<GlobalImageUsability>1</GlobalImageUsability>
<ImagingBankSpecificTest>1</ImagingBankSpecificTest>
</IVA>
<IVA num="2">
<GlobalImageQuality>0</GlobalImageQuality>
<GlobalImageUsability>1</GlobalImageUsability>
<ImagingBankSpecificTest>1</ImagingBankSpecificTest>
</IVA>
</IVA>
<BCR>
<ItemsWithinBundleCount>2</ItemsWithinBundleCount>
<BundleTotalAmount>1500</BundleTotalAmount>
<MICRValidTotalAmount>1500</MICRValidTotalAmount>
</BCR>
</ForwardBundle>
<CCR>
<BundleCount>1</BundleCount>
<ItemWithinCashLetterCount>2</ItemWithinCashLetterCount>
<CashLetterTotalAmount>1500</CashLetterTotalAmount>
<ImagesWithinCashLetterCount>2</ImagesWithinCashLetterCount>
<ECEInstitutionName>Bank Asia</ECEInstitutionName>
<SettlementDate>20090714</SettlementDate>
</CCR>
</Collection>
<ECR>
<CashLetterCount>1</CashLetterCount>
<TotalRecordCount>2</TotalRecordCount>
<TotalItemCount>2</TotalItemCount>
<FileTotalAmount>1500</FileTotalAmount>
<ImmediateOriginContactName>Bank Asia</ImmediateOriginContactName>
<ImmediateOriginContactNumber>XXX</ImmediateOriginContactNumber>
</ECR>
</OCE>
</BACPSInterface>';
l_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(l_parser, l_clob);
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
dbms_xmldom.freeDocument(l_doc);
end; -
How to Store an XML Data into Table?
Hi All,
My Requirement is "I Have an XML File (or) XML Data as CLOB, now I should decode this XML Data and find the equivalent data for columns in a table and then store that in a relational table",
Would be greatful if any one can provide me a feasible solution (or) good link where I can get this information with examples.
Thanks in advance,
Sunil NOr,
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Elapsed: 00:00:00.03
satyaki>
satyaki>
satyaki>drop table dump_tab;
Table dropped.
Elapsed: 00:00:01.08
satyaki>
satyaki>create table dump_tab
2 (
3 raw_xml clob
4 );
Table created.
Elapsed: 00:00:00.00
satyaki>
satyaki>
satyaki>desc dump_tab;
Name Null? Type
RAW_XML CLOB
satyaki>
satyaki>
satyaki>insert into dump_tab
2 select yy.rxml
3 from (
4 select (' <data>
5 <var name="document">
6 <string>Sales Order</string>
7 </var>
8 <var name="results">
9 <recordset rowcount="2">
10 <field name="sales_num">
11 <string>12345</string>
12 <string>60192</string>
13 </field>
14 <field name="ord_qty">
15 <string>10</string>
16 <string>50</string>
17 </field>
18 </recordset>
19 </var>
20 </data>'
21 ) rxml from dual
22 ) yy;
1 row created.
Elapsed: 00:00:00.00
satyaki>
satyaki>commit;
Commit complete.
Elapsed: 00:00:00.00
satyaki>
satyaki>create table results
2 (
3 serial_no number(5),
4 sales_num number(7),
5 ord_qty number(10)
6 );
Table created.
Elapsed: 00:00:00.00
satyaki>
satyaki>desc results;
Name Null? Type
SERIAL_NO NUMBER(5)
SALES_NUM NUMBER(7)
ORD_QTY NUMBER(10)
satyaki>
satyaki>select * from dump_tab;
RAW_XML
<data>
<var name="document">
<string>Sales Order</string>
</var>
<var name="results">
<recordset rowcount="2">
<field name="sales_num">
<string>12345</string>
<string>60192</string>
</field>
<field name="ord_qty">
RAW_XML
<string>10</string>
<string>50</string>
</field>
</recordset>
</var>
</data>
Elapsed: 00:00:00.01
satyaki>
satyaki>
satyaki>ed
Wrote file afiedt.buf
1 insert into results(serial_no,sales_num,ord_qty)
2 with t
3 as (
4 select xmltype(raw_xml) xml from dump_tab
5 ),
6 t1 as (select rownum rn, t1.column_value.extract('*/text()') sales_num from t t, table(xmlsequence(t.xml.extract('//field[@name="sales_num"]/string'))) t1),
7 t2 as (select rownum rn, t2.column_value.extract('*/text()') ord_qty from t t, table(xmlsequence(t.xml.extract('//field[@name="ord_qty"]/string'))) t2)
8 select t1.rn x,
9 to_number(regexp_replace(xmlelement("e",sales_num).getstringval(),'<(|/)e>','')) sales_num
10 to_number(regexp_replace(xmlelement("d",ord_qty).getstringval(),'<(|/)d>','')) ord_qty
11 from t1,t2
12* where t1.rn = t2.rn
satyaki>/
2 rows created.
Elapsed: 00:00:00.00
satyaki>
satyaki>select * from results;
SERIAL_NO SALES_NUM ORD_QTY
1 12345 10
2 60192 50
Elapsed: 00:00:00.00
satyaki>Regards.
Satyaki De. -
Hi all,
i have to create a table in the DDIC where i have to store some XML data and informations.
ID -> char
date -> date field
desc -> char
xml -> ????
What datatype shall i use to store my XML Data ?
Later in a Dynpro i need to show this XML Data. What type of control shall i use to show this XML Data ?
Can i use the browser control ? If so ... how can i pass my xml data to this control ??
Greetings
HenningYou can create a field of data type STRING if you are planning to store your XML in string or RAWSTRING if you are planning to store your data in XSTRING.
You can use the Simple CL_GUI_HTML_VIEWER to display your XML data stored in STRING or XSTRING. Take a look at the FM DISPLAY_XML_STRING.
Regards,
Naimesh Patel
Edited by: Naimesh Patel on Feb 12, 2009 10:19 AM -
Write / store xml data in Xe and retrieve stored data using pl/sql
Hi to all,
i'm searching a tutorial on:
A - how to write / store xml data in Xe and retrieve stored data using pl/sql
I don't want to use other technologies, because i use htmldb and my best practice is with pl/sql.
I was reading an ebook (quite old maybe) however it's about oracle 9 and it's talking about xmltype:
1 - I don't understand if this is a user type (clob/varchar) or it's integrated in Oracle 9 however i will read it (it's chapter 3 titled Using Oracle xmldb).
Please dont'reply here: i would be glad if someone can suggest me a good tutorial / pdf to achieve task A in Oracle XE.
ThanxThank you very much Carl,
However my fault is that i've not tried to create the table via sql plus.
Infact i was wrong thinking that oracle sql developer allows me to create an xmltype column via the create table tool.
however with a ddl script like the following the table was created successfully.
create table example1
keyvalue varchar2(10) primary key,
xmlcolumn xmltype
Thank you very much for your link.
Message was edited by:
Marcello Nocito
Maybe you are looking for
-
Can't find imovie file on my hard drive
I have a imovie file on my hard drive that I can't find. I really want to delete it so that I can free up some room on my hard rive. It's at least 15 gigs big. I tried using the search icon in the upper right hand corner and I tried using the 'find'
-
Why are my iMessages coming back as "not delivered" on ALL devices?
For the past 2 days, my iMessages have been showing the message "not delivered" on ALL of my Mac devices. iPad, iPhone and my Macbook pro. I have the new Mountain Lion software. This does not only happen when I have wi-fi on, but also when I was usin
-
Things to Remember - Into Production
We are going to Production Soon for the first time, wrt to XI. Could some one list what are all the points that we need to keep in mind when we move into production. The check list that we need to finalize etc. ( For example, I read that we have to d
-
How to change your displayed name
How do you change your displayed name in iCloud? I have tried changing the settings and I also update my Apple ID profile, but iCloud still displays my old name. The name displays in the upper right hand corner and is always displayed, even if you s
-
TCPIP adapter for BizTalk 2013
Hello, Is there a TCPIP adapter for BizTalk 2013. The one on codeplex can not be installed. Regards, Paul