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

Similar Messages

  • 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.
    Thanx

    Thank 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

  • Loading data from flatfile to relational table,i am getting SQLLDR error

    Hi,
    While loading data from flatfile to relational table,i am getting SQLLDR error and i am unable to proceed further.
    Source is a flatfile and target is a Oracle database,i used "LKM file to oracle(SQLLDR)" and "IKM sql control append"
    and ran the interface.When i checked the seesion in operator window" after generating "CTL file" successfully
    the session got failed at "Call sqlldr" and was not able to proceed further.
    Environment details:
    ODI 11g
    database:Oracle 11g
    Operating system:Windows server 2008
    The error message it displayed in call sqlldr session file was
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File "<string>", line 31, in ?
    File "C:\oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\odi\bin\..\..\jdev\extensions\oracle.odi.navigator\scripting\Lib\javaos.py", line 198, in system
    File "C:\oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\odi\bin\..\..\jdev\extensions\oracle.odi.navigator\scripting\Lib\javaos.py", line 224, in execute
    OSError: (0, 'Failed to execute command ([\'sh\', \'-c\', \'sqlldr DEVELOPER/pass_123@CPRDEV control="F:\\\\flatfile/CROSS_CURR.ctl" log="F:\\\\flatfile/CROSS_CURR.log" > "F:\\\\flatfile/CROSS_CURR.out" \']): java.io.IOException: Cannot run program "sh": CreateProcess error=2, The system cannot find the file specified')
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
         at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:345)
         at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:169)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2374)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java:1615)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java:1580)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java:2755)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2515)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:534)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:449)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1954)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:322)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:224)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:246)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:237)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:794)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:114)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
         at java.lang.Thread.run(Thread.java:619)
    could u give me a solution to sort out this error ASAP.
    thanks,
    keshav.

    This was the following code generated .
    import java.lang.String
    import java.lang.Runtime as Runtime
    from jarray import array
    import java.io.File
    import os
    import re
    import javaos
    def reportnbrows():          
         f = open(r"F:\flatfile/TEST.log", 'r')
         try:
              for line in f.readlines():
                   if line.find("MAXIMUM ERROR COUNT EXCEEDED")>=0 :
                        raise line
         finally:
              f.close()
    ctlfile = r"""F:\flatfile/TEST.ctl"""
    logfile = r"""F:\flatfile/TEST.log"""
    outfile = r"""F:\flatfile/TEST.out"""
    oracle_sid=''
    if len('CPRDEV')>0: oracle_sid = '@'+'CPRDEV'
    loadcmd = r"""sqlldr DEVELOPER/<@=snpRef.getInfo("DEST_PASS") @>%s control="%s" log="%s" > "%s" """ % (oracle_sid,ctlfile, logfile, outfile)
    rc = os.system(loadcmd)
    if rc <> 0 and rc <> 2:
    raise "Load Error", "See %s for details" % logfile
    if rc==2:
    reportnbrows()

  • How to load data to dimensions and fact table is it simialr to sql server

    How to load data to dimensions and fact table in a data ware house environment, is it simialr to sql server, oracle?
    Never migrated or loaded data to datawarehouse server.
    I have an interview and am really confused if they ask anything related to the dataware house side elements.
    Coudl you please if you don't mind provide me some steps and dimension and fact table info, an example only.
    Atleast for my knowledge.
    Thank you very much for the helpful info.

    Some discussions in previous forums should help you
    http://forums.sdn.sap.com/thread.jspa?threadID=2019448
    http://forums.sdn.sap.com/thread.jspa?threadID=1908902
    In the SAP tutorial, you can see a sample example of making fact tables.
    http://help.sap.com/businessobject/product_guides/boexir32SP1/en/xi321_ds_tutorial_en.pdf
    Arun

  • Object Tables and Relational Tables

    the statement below are they true for both Object and Relational tables?
    Rows are stored in extents
    can rows can be made up of one column
    collection types can be used in a column
    Thanks!

    >
    Rows are stored in extents
    >
    Yes - in the sense that rows are stored in 'blocks' and extents are comprised of one or more blocks. So since rows are in blocks and blocks are in extents then rows are in extents.
    >
    can rows can be made up of one column
    >
    Yes
    CREATE TABLE ONE_COLUMN_TABLE (NAME VARCHAR2(30));collection types can be used in a column
    >
    yes
    CREATE TYPE num_varray AS VARRAY(10) OF NUMBER(12, 2)
    CREATE TABLE varray_table (col1 num_varray)
    INSERT INTO varray_table VALUES (num_varray(100, 200))

  • Upload XML data using XSQL and HTTP Post ?

    Upload XML data using XSLQ and HTTP Post: is that possible ?
    An xsql contains an <xsql:insert-request table="aTable">
    The XML data file follows the ROWSET/ROW paradigm.
    What is the HTML form to upload the xml file to the XSQL ?
    I tried:
    <form action="myXSQL.xsql" method="POST" ENCTYPE="multipart/form-data">
    XML data file to upload: <input type="file">
    <input type="submit">
    </form>
    But the answer of myXSQL is:
    <xsql-status action="xsql:insert-request" result="No posted document to process" />
    Where is the problem ?
    Thank you.

    Hello,
    You are posting your XML file as a parameter therefore you should use the <xsql:insert-params/> tag, not the <xsql:insert-request/>. The insert-request can only handle data not posted via a parameter.
    Usage:
    <form action="myXSQL.xsql" method="GET" ENCTYPE="multipart/form-data">
    XML data file to upload: <input type="file" name="myXML">
    <input type="submit">
    </form>
    in combination with
    <xsql>
    <xsql:insert-params name="myXML" table="your table"/>
    </xsql>
    2 remarks:
    I was not able to succesfully POST the form. The answer was <xsql-status action="xsql:insert-request" result="No posted document to process" />. With GET is was succesfull.
    Second, if you use MSInternet explorer 5 or higher use could post the XML directly (not aw parameter) using an ActiveX object.
    Regards,
    Harm Verschuren

  • How can i update data in okc_k_items and csi_item_instances tables?

    How can i update data in okc_k_items and csi_item_instances tables?
    by EBS .
    Thanks.

    For csi_item_instances table, you can use the following API:
    CSI_ITEM_INSTANCE_PUB.UPDATE_ITEM_INSTANCE
    For okc_k_items, try using the following API:
    OKC_CONTRACT_ITEM_PUB.UPDATE_CONTRACT_ITEM
    Hope this helps!

  • Syntax of DDL options and related (table) column names

    Hi,
    where can I find something like a mapping between DDL options and related table column names?
    For example I do have the table options PCTFREE, FREELISTS and NOCOMPRESS. The related table columns out of user_tables are PCT_FREE, FREELIST and COMPRESS.
    PCT(_)FREE wins an Underscore, FREELIST(S) wins an "S" and it is "NOCOMPRESS" if COMPRESS has a value "Y(es)".
    Hope somebody can help.

    So far I didn't find any information that is not in
    the DDL script gernerated from
    DBMS_METADATA.get_DDL.Alright, I give you an example:
    I create a table with the following DDL:
    "CREATE TABLE IntBuch (
    int_bunr integer NOT NULL,
    int_sdat double precision NOT NULL,
    int_hblz char(8) NOT NULL,
    int_hkto char(7) NOT NULL,
    int_hdat double precision NOT NULL,
    KtoNr char(7) NOT NULL,
    BLZ char(8) NOT NULL,
    CONSTRAINT PK_IntBuch PRIMARY KEY (int_bunr)
    USING INDEX
    PCTFREE 10
    STORAGE (
    INITIAL 1000
    NEXT 500
    PCTINCREASE 0
    MINEXTENTS 1
    MAXEXTENTS 4096
    PCTFREE 20
    LOGGING
    CREATE UNIQUE INDEX intid
    ON IntBuch (int_bunr DESC)
    CREATE INDEX hkto
    ON IntBuch (int_hblz,int_hkto)
    COMMENT ON TABLE IntBuch
    IS 'Kommentar zu DB-Tabelle InBuch'
    COMMENT ON COLUMN IntBuch.int_sdat IS 'Kommentar zu DB-Spalte int_sdat'
    ALTER TABLE IntBuch
    ADD CONSTRAINT Gutschrift FOREIGN KEY (int_hkto,int_hblz) REFERENCES Konto
    ON DELETE CASCADE
    ADD FOREIGN KEY (KtoNr,BLZ) REFERENCES Konto
    ADD FOREIGN KEY (int_bunr) REFERENCES Buchung
    ON DELETE CASCADE
    After that I read the DDL with DBMS_METADATA.get_DDL and I get
    " CREATE TABLE "UOENDE"."INTBUCH"
    (     "INT_BUNR" NUMBER(*,0) NOT NULL ENABLE,
         "INT_SDAT" FLOAT(126) NOT NULL ENABLE,
         "INT_HBLZ" CHAR(8) NOT NULL ENABLE,
         "INT_HKTO" CHAR(7) NOT NULL ENABLE,
         "INT_HDAT" FLOAT(126) NOT NULL ENABLE,
         "KTONR" CHAR(7) NOT NULL ENABLE,
         "BLZ" CHAR(8) NOT NULL ENABLE,
         CONSTRAINT "PK_INTBUCH" PRIMARY KEY ("INT_BUNR")
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 16384 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS" ENABLE,
         CONSTRAINT "GUTSCHRIFT" FOREIGN KEY ("INT_HKTO", "INT_HBLZ")
         REFERENCES "UOENDE"."KONTO" ("KTONR", "BLZ") ON DELETE CASCADE ENABLE,
         FOREIGN KEY ("KTONR", "BLZ")
         REFERENCES "UOENDE"."KONTO" ("KTONR", "BLZ") ENABLE,
         FOREIGN KEY ("INT_BUNR")
         REFERENCES "UOENDE"."BUCHUNG" ("BU_NR") ON DELETE CASCADE ENABLE
    ) PCTFREE 20 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS"
    If there are no more DDLOptions possible than that, it is fine for me. If not, but all kinds of options are to find in only one or two tables of the database ( user_tables for table options, dba_constraints and dba_segments for column options, primary and foreign keys, user_indexes and user_segments for indexes ...), that is fine for me, too. (As long as I get to know which tables are "sufficient" for that.) If it is different than both of that, that's bad.
    However if you want to use defaults instead of
    absolut values, it is better to remove certain parts,
    like the storage clause, from the generated output.I understand this, but I am more interested to have all and not leaving out some of them in order to have the defaults in the database after running the DDL.
    A totally different approach could be to
    a) create a database link from one DB to another.
    b) create table <new_table> as select * from
    <old_table@dbLink> where 1=2;I keep that in mind, thanks for that hint.

  • Tcode to enter data in estmj and estrh tables?

    can any one know which tcode i have to use to enter data in estrh and estmj tables?

    It is actually telling me that CG01 is obselete in my 46c system, it will not l let me do anything else with that transaction.  I go to CG02, and I am able to create there.
    Regards,
    Rich Heilman

  • 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 values

    I 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.

  • From XML in CLOB to relational table doubt

    versions 11.2.0.2.0 / 10.2.0.4.0
    It's a long time, no see since my last dealing with xml and no luck to have an attribute value returned into the relational table.
    It's *<IntrBkSttlmAmt Ccy="???">999999</IntrBkSttlmAmt>*
    For the rest the below works in both versions but used on an xml having a 10000 <CdtTrfTxInf> on 11g it took 9 seconds and was killed because no answer was produced after 30 minutes on 10g. A colleague using java loaded the relational table in 34 seconds on 10g and produced the relational table on 11g in just 5 seconds.
    The 10g version is surviving with no xmldb installed and there are rumors our thinking heads didn't succeed to deactivate it on 11g yet.
    Any suggestion concerning alternate ways to produce a relational table from an xmltype located in a clob column of a relational table are welcome
    (looking at CLOB in XML to Normal table Best approach? I thought too many xmltable would have to be used)
    with
    the_data as
    (select q'~
                <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.01">
                   <pacs.008.001.01>
                      <GrpHdr>
                         <MsgId>1L1U000JB4UT1FVS</MsgId>
                         <MsgId>9X9X999XX9XX9XXX</MsgId>
                         <CreDtTm>YYYY-MM-DDTHH:MI:SS</CreDtTm>
                         <NbOfTxs>99999</NbOfTxs>
                         <TtlIntrBkSttlmAmt Ccy="???">9999999</TtlIntrBkSttlmAmt>
                         <IntrBkSttlmDt>YYYY-MM-DD</IntrBkSttlmDt>
                            <SttlmInf>
                               <SttlmMtd>XXXX</SttlmMtd>
                                  <ClrSys>
                                      <ClrSysId>XXXX</ClrSysId>
                                  </ClrSys>
                               </SttlmInf>
                      </GrpHdr>
                      <CdtTrfTxInf>
                         <PmtId>
                            <InstrId>XXXXXXX999999-XX999999.XX</InstrId>
                            <EndToEndId>X9999999999</EndToEndId>
                            <TxId>X9999-9999999999</TxId>
                         </PmtId>
                         <PmtTpInf>
                            <SvcLvl>
                               <Cd>XXXX</Cd>
                            </SvcLvl>
                        </PmtTpInf>
                        <IntrBkSttlmAmt Ccy="???">999999</IntrBkSttlmAmt>
                        <ChrgBr>XXXX</ChrgBr>
                        <InstgAgt>
                           <FinInstnId>
                              <BIC>XXXXXX9X</BIC>
                           </FinInstnId>
                        </InstgAgt>
                        <Dbtr>
                           <Nm>NAME</Nm>
                           <PstlAdr>
                              <AdrLine>ADDRESS</AdrLine>
                              <AdrLine>CITY</AdrLine>
                              <Ctry>XX</Ctry>
                           </PstlAdr>
                        </Dbtr>
                        <DbtrAcct>
                           <Id>
                              <IBAN>XX99999999999999999</IBAN>
                           </Id>
                        </DbtrAcct>
                        <DbtrAgt>
                           <FinInstnId>
                              <BIC>XXXXXX9X</BIC>
                           </FinInstnId>
                        </DbtrAgt>
                        <CdtrAgt>
                           <FinInstnId>
                              <BIC>XXXXXX9X</BIC>
                           </FinInstnId>
                        </CdtrAgt>
                        <Cdtr>
                           <Nm>NAME</Nm>
                           <PstlAdr>
                              <AdrLine>ADDRESS</AdrLine>
                              <AdrLine>CITY</AdrLine>
                              <Ctry>XX</Ctry>
                           </PstlAdr>
                        </Cdtr>
                        <CdtrAcct>
                           <Id>
                              <IBAN>XX99999999999999999</IBAN>
                           </Id>
                        </CdtrAcct>
                        <RmtInf>
                           <Strd>
                              <CdtrRefInf>
                                 <CdtrRef>X99999999-9999999999</CdtrRef>
                              </CdtrRefInf>
                              <AddtlRmtInf>ADDITIONAL INFO</AddtlRmtInf>
                           </Strd>
                        </RmtInf>
                      </CdtTrfTxInf>
                   </pacs.008.001.01>
                </Document>
              ~' the_column
       from dual
    select v.instrid,v.endtoendid,v.txid,v.cd,
           v.ccy,  /* returned as NULL - the only attribute value */
           v.intrbksttlmamt,v.chrgbr,v.bic1,v.nm1,v.adrline11,v.adrline12,v.ctry1,v.iban1,
           v.bic2,v.bic3,v.nm2,v.adrline21,v.adrline22,v.ctry2,v.iban2,v.cdtrref,v.addtlrmtinf
      from (select xmltype(the_column) the_column_xml
              from the_data
           ) w,
           xmltable(xmlnamespaces(default 'urn:iso:std:iso:20022:tech:xsd:pacs.008.001.01'),
                    'for $r in /Document/pacs.008.001.01/CdtTrfTxInf
                     return <rw>
                              <InstrId>{$r/PmtId/InstrId}</InstrId>
                              <EndToEndId>{$r/PmtId/EndToEndId}</EndToEndId>
                              <TxId>{$r/PmtId/TxId}</TxId>
                              <Cd>{$r/PmtTpInf/SvcLvl/Cd}</Cd>
                              <Ccy>{$r/IntrBkSttlmAmt/@Ccy}</Ccy>
                              <IntrBkSttlmAmt>{ora:replace($r/IntrBkSttlmAmt,"[.]",",")}</IntrBkSttlmAmt>
                              <ChrgBr>{$r/ChrgBr}</ChrgBr>
                              <BIC1>{$r/InstgAgt/FinInstnId}</BIC1>
                              <Nm1>{$r/Dbtr/Nm}</Nm1>
                              <AdrLine11>{$r/Dbtr/PstlAdr/AdrLine[1]}</AdrLine11>
                              <AdrLine12>{$r/Dbtr/PstlAdr/AdrLine[2]}</AdrLine12>
                              <Ctry1>{$r/Dbtr/PstlAdr/Ctry}</Ctry1>
                              <IBAN1>{$r/DbtrAcct/Id}</IBAN1>
                              <BIC2>{$r/DbtrAgt/FinInstnId}</BIC2>
                              <BIC3>{$r/CdtrAgt/FinInstnId}</BIC3>
                              <Nm2>{$r/Cdtr/Nm}</Nm2>
                              <AdrLine21>{$r/Cdtr/PstlAdr/AdrLine[1]}</AdrLine21>
                              <AdrLine22>{$r/Cdtr/PstlAdr/AdrLine[2]}</AdrLine22>
                              <Ctry2>{$r/Cdtr/PstlAdr/Ctry}</Ctry2>
                              <IBAN2>{$r/CdtrAcct/Id}</IBAN2>
                              <CdtrRef>{$r/RmtInf/Strd/CdtrRefInf/CdtrRef}</CdtrRef>
                              <AddtlRmtInf>{$r/RmtInf/Strd/AddtlRmtInf}</AddtlRmtInf>
                            </rw>'
                     passing w.the_column_xml
                     columns instrid         varchar2(300)   path '/rw/InstrId',
                             endtoendid      varchar2(150)   path '/rw/EndToEndId',
                             txid            varchar2(200)   path '/rw/TxId',
                             cd              varchar2(50)    path '/rw/Cd',
                             ccy             varchar2(50)    path '/rw/Ccy',
                             intrbksttlmamt  varchar2(50)    path '/rw/IntrBkSttlmAmt',
                             chrgbr          varchar2(100)   path '/rw/ChrgBr',
                             bic1            varchar2(100)   path '/rw/BIC1',
                             nm1             varchar2(1000)  path '/rw/Nm1',
                             adrline11       varchar2(1000)  path '/rw/AdrLine11',
                             adrline12       varchar2(1000)  path '/rw/AdrLine12',
                             ctry1           varchar2(50)    path '/rw/Ctry1',
                             iban1           varchar2(200)   path '/rw/IBAN1',
                             bic2            varchar2(100)   path '/rw/BIC2',
                             bic3            varchar2(100)   path '/rw/BIC3',
                             nm2             varchar2(1000)  path '/rw/Nm2',
                             adrline21       varchar2(1000)  path '/rw/AdrLine21',
                             adrline22       varchar2(1000)  path '/rw/AdrLine22',
                             ctry2           varchar2(50)    path '/rw/Ctry2',
                             iban2           varchar2(200)   path '/rw/IBAN2',
                             cdtrref         varchar2(1000)  path '/rw/CdtrRef',
                             addtlrmtinf     varchar2(1000)  path '/rw/AddtlRmtInf'
                   ) vRegards
    Etbin

    Hi,
    It's a long time, no see since my last dealing with xml and no luck to have an attribute value returned into the relational table.When you use this :
    <Ccy>{$r/IntrBkSttlmAmt/@Ccy}</Ccy>That doesn't set the value of the Ccy element with the attribute value, but actually add the attribute Ccy to the element Ccy, which results in
    <Ccy Ccy="???"></Ccy>Knowing that, you have three options :
    1) Leaving the XQuery as it is and using this instead in the COLUMNS clause :
                             ccy             varchar2(50)    path '/rw/Ccy/@Ccy',2) Modifying the XQuery to get the atomic value out of the attribute (using the fn:data function) :
                              <Ccy>{fn:data($r/IntrBkSttlmAmt/@Ccy)}</Ccy>3) Simplifying the whole thing, something like :
    select v.instrid, v.endtoendid, v.txid, v.cd, v.ccy,
           replace(v.intrbksttlmamt,'.',',') as intrbksttlmamt, v.chrgbr, v.bic1, v.nm1, v.adrline11, v.adrline12, v.ctry1, v.iban1,
           v.bic2, v.bic3, v.nm2, v.adrline21, v.adrline22, v.ctry2, v.iban2, v.cdtrref, v.addtlrmtinf
      from the_data w,
           xmltable(xmlnamespaces(default 'urn:iso:std:iso:20022:tech:xsd:pacs.008.001.01'),
                    '/Document/pacs.008.001.01/CdtTrfTxInf'
                     passing xmltype(w.the_column)
                     columns instrid         varchar2(300)   path 'PmtId/InstrId',
                             endtoendid      varchar2(150)   path 'PmtId/EndToEndId',
                             txid            varchar2(200)   path 'PmtId/TxId',
                             cd              varchar2(50)    path 'PmtTpInf/SvcLvl/Cd',
                             ccy             varchar2(50)    path 'IntrBkSttlmAmt/@Ccy',
                             intrbksttlmamt  varchar2(50)    path 'IntrBkSttlmAmt',
                             chrgbr          varchar2(100)   path 'ChrgBr',
                             bic1            varchar2(100)   path 'InstgAgt/FinInstnId',
                             nm1             varchar2(1000)  path 'Dbtr/Nm',
                             adrline11       varchar2(1000)  path 'Dbtr/PstlAdr/AdrLine[1]',
                             adrline12       varchar2(1000)  path 'Dbtr/PstlAdr/AdrLine[2]',
                             ctry1           varchar2(50)    path 'Dbtr/PstlAdr/Ctry',
                             iban1           varchar2(200)   path 'DbtrAcct/Id',
                             bic2            varchar2(100)   path 'DbtrAgt/FinInstnId',
                             bic3            varchar2(100)   path 'CdtrAgt/FinInstnId',
                             nm2             varchar2(1000)  path 'Cdtr/Nm',
                             adrline21       varchar2(1000)  path 'Cdtr/PstlAdr/AdrLine[1]',
                             adrline22       varchar2(1000)  path 'Cdtr/PstlAdr/AdrLine[2]',
                             ctry2           varchar2(50)    path 'Cdtr/PstlAdr/Ctry',
                             iban2           varchar2(200)   path 'CdtrAcct/Id',
                             cdtrref         varchar2(1000)  path 'RmtInf/Strd/CdtrRefInf/CdtrRef',
                             addtlrmtinf     varchar2(1000)  path 'RmtInf/Strd/AddtlRmtInf'
                   ) vThat last option could possibly get you some performance improvement as well.
    Edited by: odie_63 on 14 sept. 2011 20:57

  • Storing XML Data in a Table

    I wan to store some XML Data in a table. The sole purpose is to break the big XML in smaller chunks so that I only work with what I need to. I am a newbie at this so any help will be appreciated.
    Sample XML:
    <root>
       <row id="1">
          <node1>hello</node1>
          <node2>hola</node2>
       </row>
       <row id="2">
          <node1>hello</node1>
          <node2>hola</node2>
       </row>
    </root>Expected Result in the table:
    ID             Data
    1             <row id="1"><node1>hello</node1><node2>hola</node2></row>
    2             <row id="2"><node1>hello</node1><node2>hola</node2></row>My file is pretty big, so if I can do this with SQL Loader or another similar process it would be handy.
    Thanks.

    If anyone needs this by any chnace:
    DECLARE
       PROCEDURE load_xml (
          p_dir        IN   VARCHAR2
        , p_filename   IN   VARCHAR2
       AS
          l_bfile           BFILE                       := BFILENAME (p_dir, p_filename);
          l_clob_xml        CLOB;
          l_xml_doc         DBMS_XMLDOM.domdocument;
          l_top_node        DBMS_XMLDOM.domnode;
          l_top_node_list   DBMS_XMLDOM.domnodelist;
          l_claim_node      DBMS_XMLDOM.domnode;
          l_attr_node       DBMS_XMLDOM.domnode;
          l_attr_map        DBMS_XMLDOM.domnamednodemap;
          l_clob_data       CLOB;
          l_claim_id        VARCHAR2 (500);
          l_root_node       DBMS_XMLDOM.domnode;
          l_new_node        DBMS_XMLDOM.domnode;
       BEGIN
          -- Open a file and store the data as CLOB
          DBMS_LOB.createtemporary (l_clob_xml, TRUE);
          DBMS_LOB.fileopen (l_bfile, DBMS_LOB.file_readonly);
          DBMS_LOB.loadfromfile (l_clob_xml
                               , l_bfile
                               , DBMS_LOB.getlength (l_bfile)
          DBMS_LOB.fileclose (l_bfile);
          -- Close file
          -- Create DOMDocument handle
          l_xml_doc := DBMS_XMLDOM.newdomdocument (l_clob_xml);
          l_top_node := DBMS_XMLDOM.makenode (DBMS_XMLDOM.getdocumentelement (l_xml_doc));
          l_top_node_list := DBMS_XMLDOM.getchildnodes (l_top_node);
          FOR x IN 0 .. DBMS_XMLDOM.getlength (l_top_node_list) - 1
          LOOP
             DBMS_LOB.createtemporary (l_clob_data, TRUE);
             l_claim_node := DBMS_XMLDOM.item (l_top_node_list, x);
             l_attr_map := DBMS_XMLDOM.getattributes (l_claim_node);
             l_attr_node := DBMS_XMLDOM.getnameditem (l_attr_map, 'id');
             l_claim_id := DBMS_XMLDOM.getnodevalue (l_attr_node);
             l_root_node := DBMS_XMLDOM.clonenode (n         => l_top_node, deep => FALSE);
             l_new_node := DBMS_XMLDOM.appendchild (n             => l_root_node, newchild => l_claim_node);
             DBMS_XMLDOM.writetoclob (l_root_node, l_clob_data);
    --         DBMS_OUTPUT.put_line (l_claim_id);
    --         DBMS_OUTPUT.put_line (l_clob_data);
    --         DBMS_OUTPUT.put_line ('---------------------------');
             INSERT INTO temp_xml_test
                         (claim_id
                        , xml_doc
                  VALUES (l_claim_id
                        , l_clob_data
             DBMS_LOB.freetemporary (l_clob_data);
          END LOOP;
          COMMIT;
          DBMS_LOB.freetemporary (l_clob_xml);
       EXCEPTION
          WHEN OTHERS
          THEN
             ROLLBACK;
             DBMS_OUTPUT.put_line (SQLCODE);
             DBMS_OUTPUT.put_line (SQLERRM);
             DBMS_LOB.freetemporary (l_clob_xml);
             DBMS_LOB.freetemporary (l_clob_data);
             RAISE;
       END;
    BEGIN
       load_xml ('INPUT_DIR', 'Audit_082008.xml');
    END;

  • Fetch XML data from CLOB

    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 properly

    Difficult 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

  • Problem in Selecting the data from EKPO and KONV tables

    Hi Experts,
    Presently I am working on Report with Comparision-Sheet Between the vendor's Quotations. I have to display the Discount, Freight, Packing and Forwarding, Vat in Item level data based on the conditions made in PO.
    As per my Knowledge, Condition Types are stored in KONV Table. But there is no relation between KONV and EKPO tables.  So, I am unable to print the data for Discount, Freight, Packing and Forwarding, Vat... How can I get the values from EKPO and KONV tables?
    Thanks in Advance.
    Thanks n Regards,
    Muralikrishna.

    Don't recall if this is correct, but you may need the condition number from the header (EKKO) combined with EKPO-EBELP or other field as you key to access KONV (KNUMH and KPOSN).  My site doesn't run PP, so can't verify if the data is actually stored that, so just a possibility.

  • Changes to xml data in clob

    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:
    user500620

    Thank 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 ;

Maybe you are looking for

  • Song order problem

    Some of the songs on certain albums are showing up out of order on my Ipod, even though they are in the correct order on itunes. All the track numbers are correct and all of the info for each track on the album is the same, so why is it different bet

  • Hard Drive Failed - How to get Blog/iWeb back to new hard drive?

    Our hard drive failed and none of the data is recoverable. I have a new hard drive and want to do a new post on our blog, but am worried it will delete our old blog (hence all our pix etc too) if I publish from this empty new blog. How do I get the o

  • Why doesnt my phone connect to itunes anymore?

    my phone doesnt allow me to connect to itunes and its been really glitchy

  • WM configuration related

    Hi i did all configuration settings for WM. But while creating TO from TR its throwing Abort message " Maintain Number Range Interval for " Inventory Document" could any body tell me where i m missing the settings??? Pls help me out Best Regards Subh

  • User credentials check in the webLogic web service server

    Hi, I am having a simple web service deployed in WebLogic server. I need to customize the SOAP header of this webservice to include username, password, session token and session type parameter in the server side code and do further processsing like c