XML BLOB/CLOB to relational structure

Hi
I would like peoples views on the best approach to the folllowing scenario
We are implementing a new payments engine (major bank), the vendors DB is a mix of normal relational tables & XML including XML CLOB/BLOB. In the latter case, the original incoming payment message and the enriched outgoing payment message is stored as XML CLOB. The vendor has no OOTB reporting capabilities so our approach is to replicate the production database using GoldenGate. We then plan to cretae a fully relational oracle database as an ODS (near real time) with B.O sitting over the top for reporting. We will use Oracle Data Integrator to extract the data from the rplicated copy of the live DB every 10 mins, shred the XML clob components and store in normal relational tables in the ODI.
Does anyone see major problems with this approach and can anyone suggest a better approach

Hi
I would like peoples views on the best approach to the folllowing scenario
We are implementing a new payments engine (major bank), the vendors DB is a mix of normal relational tables & XML including XML CLOB/BLOB. In the latter case, the original incoming payment message and the enriched outgoing payment message is stored as XML CLOB. The vendor has no OOTB reporting capabilities so our approach is to replicate the production database using GoldenGate. We then plan to cretae a fully relational oracle database as an ODS (near real time) with B.O sitting over the top for reporting. We will use Oracle Data Integrator to extract the data from the rplicated copy of the live DB every 10 mins, shred the XML clob components and store in normal relational tables in the ODI.
Does anyone see major problems with this approach and can anyone suggest a better approach

Similar Messages

  • 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

  • Date insertion from large XML document (clob) into relation table very slow

    Hi Everybody!
    I'm working with Oracle 9.2.0.5 on Microsoft Windows Server 2003 Enterprise Edition.
    The server (a test server) is a Pentium 4 2.8 GHz, 1GB of RAM.
    I use a procedure called PARITOP_TRAITERXMLRESULTMASSE to insert the data contained in the pXMLDOC clob parameter in the table pTABLENAME. (You can see the format of the XML document below). The first step on this procedure is to verify that the XML document is not empty. If not, the procedure needs to add a node in the document, in every <ROW> tag. This added node is named “RST_ID”. It’s the foreign key of each record. I can retrieve the value of each <RST_ID> node in an other table in which the data has been previously added (by the calling procedure). When each of the <ROW> elements has been treated, the PARITOP_INSERTXML procedure is called. This procedure uses DBMS_XMLSAVE.INSERTXML to insert the data contained in the XML document in the specified table.
    (Below, you can see the code of my procedures.)
    With this information, can you tell me why this treatment is very very very slow with a large XML document and how I can improve it?
    Thank you for your help!
    Anne-Marie
    CREATE OR REPLACE PROCEDURE "PARITOP_TRAITERXMLRESULTMASSE" (
    pPRC_ID IN PARITOP_PARC.PRC_ID%TYPE,
    pRST_MONDE IN PARITOP_RESULTAT.RST_MONDE%TYPE,
    pXMLDOC IN CLOB,
    pTABLENAME IN VARCHAR2)
    AS
    Objectif :Insérer le contenu du XML passé en paramètre (pXMLDOC) à la table passée en paramètre (pTABLENAME)
    La table passée en paramètre doit être une table ayant comme clé étrangère le champs "RST_ID" .
    (Le noeud RST_ID est donc ajouté à tous les document XML. Ce rst_id est
    déterminé à partir de la table PARITOP_RESULTAT grâce à pPRC_ID et
    pRstMonde fournis en paramètre)
    result_doc CLOB;
    XMLDOMDOC XDB.DBMS_XMLDOM.DOMDOCUMENT;
    NODE_ROWSET DBMS_XMLDOM.DOMNODE;
    NODE_ROW DBMS_XMLDOM.DOMNODE;
    vUE_ID PARITOP_RESULTAT.UE_ID%TYPE;
    vRST_ID PARITOP_RESULTAT.RST_ID%TYPE;
    nodeList DBMS_XMLDOM.DOMNODELIST;
    BEGIN
    BEGIN
    vUE_ID := 0;
    vRST_ID := 0;
    XMLDOMDOC := DBMS_XMLDOM.NEWDOMDOCUMENT(pXMLDOC);
    IF NOT GESTXML_PKG.FN_PARITOP_DOCUMENT_IS_NULL(XMLDOMDOC) THEN
    NODE_ROWSET := DBMS_XMLDOM.item(DBMS_XMLDOM.GETCHILDNODES (DBMS_XMLDOM.MAKENODE(XMLDOMDOC)),0);
    for i in 0..dbms_xmldom.getLength(DBMS_XMLDOM.getchildnodes(NODE_ROWSET))-1 loop
    NODE_ROW := DBMS_XMLDOM.ITEM(DBMS_XMLDOM.GETCHILDNODES(NODE_ROWSET), i) ;
    nodeList := DBMS_XMLDOM.GETELEMENTSBYTAGNAME(DBMS_XMLDOM.makeelement(NODE_ROW) , 'UE_ID');
    IF vUE_ID <> DBMS_XMLDOM.GETNODEVALUE(DBMS_XMLDOM.GETFIRSTCHILD(DBMS_XMLDOM.ITEM(nodeList, 0))) THEN
    vUE_ID := DBMS_XMLDOM.GETNODEVALUE(DBMS_XMLDOM.GETFIRSTCHILD(DBMS_XMLDOM.ITEM(nodeList, 0)));
    --on ramasse le rst_id
    SELECT RST_ID INTO vRST_ID
    FROM PARITOP_RESULTAT RST
    WHERE RST.PRC_ID = pPRC_ID
    AND RST.UE_ID = vUE_ID
    AND RST.RST_MONDE = pRST_MONDE
    AND RST_A_SUPPRIMER = 0;
    END IF;
    GESTXML_PKG.PARITOP_ADDNODETOROW(XMLDOMDOC, NODE_ROW, 'RST_ID', vRST_ID);
    end loop;
    RESULT_DOC := ' '; --à garder, pour ne pas que ca fasse d'erreur lors du WriteToClob.
    dbms_xmldom.writeToClob(DBMS_XMLDOM.MAKENODE(XMLDOMDOC), RESULT_DOC);
    --Insertion du document XML dans la table "tableName"
    GESTXML_PKG.PARITOP_INSERTXML(RESULT_DOC, pTABLENAME);
    DBMS_XMLDOM.FREEDOCUMENT( XMLDOMDOC);
    end if;
    EXCEPTION
    […exception treatement…]
    END;
    END;
    The format of a XML clob is :
    <ROWSET>
    <ROW>
    <PRC_ID>193</PRC_ID>
    <UE_ID>8781</UE_ID>
    <VEN_ID>6223</VEN_ID>
    <RST_MONDE>0</RST_MONDE>
    <CMP_SELMAN>0</CMP_SELMAN>
    <CMP_INDICESELECTION>92.307692307692307</CMP_INDICESELECTION>
    <CMP_PVRES>94900</CMP_PVRES>
    <CMP_PVAJUSTE>72678.017699115066</CMP_PVAJUSTE>
    <CMP_PVAJUSTEMIN>72678.017699115095</CMP_PVAJUSTEMIN>
    <CMP_PVAJUSTEMAX>72678.017699115037</CMP_PVAJUSTEMAX>
    <CMP_PV>148000</CMP_PV>
    <CMP_VALROLE>129400</CMP_VALROLE>
    <CMP_PVRESECART>4790</CMP_PVRESECART>
    <CMP_PVRHAB>101778.01769911509</CMP_PVRHAB>
    <CMP_UTILISE>1</CMP_UTILISE>
    <CMP_TVM>1</CMP_TVM>
    <CMP_PVA>148000</CMP_PVA>
    </ROW>
    <ROW>
    <PRC_ID>193</PRC_ID>
    <UE_ID>8781</UE_ID>
    <VEN_ID>6235</VEN_ID>
    <RST_MONDE>0</RST_MONDE>
    <CMP_SELMAN>0</CMP_SELMAN>
    <CMP_INDICESELECTION>76.92307692307692</CMP_INDICESELECTION>
    <CMP_PVRES>117800</CMP_PVRES>
    <CMP_PVAJUSTE>118080</CMP_PVAJUSTE>
    <CMP_PVAJUSTEMIN>118080</CMP_PVAJUSTEMIN>
    <CMP_PVAJUSTEMAX>118080</CMP_PVAJUSTEMAX>
    <CMP_PV>172000</CMP_PV>
    <CMP_VALROLE>134800</CMP_VALROLE>
    <CMP_PVRESECART>0</CMP_PVRESECART>
    <CMP_PVRHAB>147180</CMP_PVRHAB>
    <CMP_UTILISE>1</CMP_UTILISE>
    <CMP_TVM>1</CMP_TVM>
    <CMP_PVA>172000</CMP_PVA>
    </ROW>
    </ROWSET>
    PARITOP_COMPARABLE TABLE :
    RST_ID NUMBER(10) NOT NULL,
    VEN_ID NUMBER(10) NOT NULL,
    CMP_SELMAN NUMBER(1) NOT NULL,
    CMP_UTILISE NUMBER(1) NOT NULL,
    CMP_INDICESELECTION FLOAT(53) NOT NULL,
    CMP_PVRES FLOAT(53) NULL,
    CMP_PVAJUSTE FLOAT(53) NULL,
    CMP_PVRHAB FLOAT(53) NULL,
    CMP_TVM FLOAT(53) NULL
    ROCEDURE PARITOP_INSERTXML (xmlDoc IN clob, tableName IN VARCHAR2)
    AS
    insCtx DBMS_XMLSave.ctxType;
    rowss number;
    BEGIN
    --permet d'insérer les champs du XML dans la table passée en paramètre.
    --il suffit que les champs XML aient le même nom que les champs de la table
    BEGIN
    insCtx := DBMS_XMLSave.newContext(tableName); -- get context handle
    DBMS_XMLSAVE.SETDATEFORMAT( insCtx, 'yyyy-MM-dd HH:mm:ss');--attention, case sensitive
    DBMS_XMLSAVE.setIgnoreCase(insCtx, 1);
    rowss := DBMS_XMLSAVE.INSERTXML(insCtx , xmlDoc);
    DBMS_XMLSave.closeContext(insCtx);
    EXCEPTION
    […]
    END;
    END;
    PROCEDURE PARITOP_ADDNODETOROW (
    XMLDOMDOC DBMS_XMLDOM.DOMDOCUMENT,
    NODE_ROW dbms_xmldom.DOMNode,
    NOM_NOEUD VARCHAR2,
    VALEUR_NOEUD VARCHAR2)
    AS
    --PERMET D'AJOUTER UN NOEUD AVEC 1 SEULE VALEUR DANS une ROW D'UN XML.
    --UTILE SURTOUT POUR LES CLÉS ÉTRANGÈRES
    domElemAInserer DBMS_XMLDOM.DOMELEMENT;
    NODE dbms_xmldom.DOMNode;
    NODE_TMP dbms_xmldom.DOMNode;
    BEGIN
    domElemAInserer := DBMS_XMLDOM.createElement(XMLDOMDOC, NOM_NOEUD) ;
    NODE := DBMS_XMLDOM.MAKENODE(domElemAInserer); --cast
    NODE := DBMS_XMLDOM.APPENDCHILD(NODE_ROW,NODE);
    NODE_TMP := DBMS_XMLDOM.MAKENODE(DBMS_XMLDOM.CREATETEXTNODE(XMLDOMDOC, VALEUR_NOEUD ) );
    NODE := DBMS_XMLDOM.APPENDCHILD(NODE,NODE_TMP );
    END;

    Hi Everybody!
    I'm working with Oracle 9.2.0.5 on Microsoft Windows Server 2003 Enterprise Edition.
    The server (a test server) is a Pentium 4 2.8 GHz, 1GB of RAM.
    I use a procedure called PARITOP_TRAITERXMLRESULTMASSE to insert the data contained in the pXMLDOC clob parameter in the table pTABLENAME. (You can see the format of the XML document below). The first step on this procedure is to verify that the XML document is not empty. If not, the procedure needs to add a node in the document, in every <ROW> tag. This added node is named “RST_ID”. It’s the foreign key of each record. I can retrieve the value of each <RST_ID> node in an other table in which the data has been previously added (by the calling procedure). When each of the <ROW> elements has been treated, the PARITOP_INSERTXML procedure is called. This procedure uses DBMS_XMLSAVE.INSERTXML to insert the data contained in the XML document in the specified table.
    (Below, you can see the code of my procedures.)
    With this information, can you tell me why this treatment is very very very slow with a large XML document and how I can improve it?
    Thank you for your help!
    Anne-Marie
    CREATE OR REPLACE PROCEDURE "PARITOP_TRAITERXMLRESULTMASSE" (
    pPRC_ID IN PARITOP_PARC.PRC_ID%TYPE,
    pRST_MONDE IN PARITOP_RESULTAT.RST_MONDE%TYPE,
    pXMLDOC IN CLOB,
    pTABLENAME IN VARCHAR2)
    AS
    Objectif :Insérer le contenu du XML passé en paramètre (pXMLDOC) à la table passée en paramètre (pTABLENAME)
    La table passée en paramètre doit être une table ayant comme clé étrangère le champs "RST_ID" .
    (Le noeud RST_ID est donc ajouté à tous les document XML. Ce rst_id est
    déterminé à partir de la table PARITOP_RESULTAT grâce à pPRC_ID et
    pRstMonde fournis en paramètre)
    result_doc CLOB;
    XMLDOMDOC XDB.DBMS_XMLDOM.DOMDOCUMENT;
    NODE_ROWSET DBMS_XMLDOM.DOMNODE;
    NODE_ROW DBMS_XMLDOM.DOMNODE;
    vUE_ID PARITOP_RESULTAT.UE_ID%TYPE;
    vRST_ID PARITOP_RESULTAT.RST_ID%TYPE;
    nodeList DBMS_XMLDOM.DOMNODELIST;
    BEGIN
    BEGIN
    vUE_ID := 0;
    vRST_ID := 0;
    XMLDOMDOC := DBMS_XMLDOM.NEWDOMDOCUMENT(pXMLDOC);
    IF NOT GESTXML_PKG.FN_PARITOP_DOCUMENT_IS_NULL(XMLDOMDOC) THEN
    NODE_ROWSET := DBMS_XMLDOM.item(DBMS_XMLDOM.GETCHILDNODES (DBMS_XMLDOM.MAKENODE(XMLDOMDOC)),0);
    for i in 0..dbms_xmldom.getLength(DBMS_XMLDOM.getchildnodes(NODE_ROWSET))-1 loop
    NODE_ROW := DBMS_XMLDOM.ITEM(DBMS_XMLDOM.GETCHILDNODES(NODE_ROWSET), i) ;
    nodeList := DBMS_XMLDOM.GETELEMENTSBYTAGNAME(DBMS_XMLDOM.makeelement(NODE_ROW) , 'UE_ID');
    IF vUE_ID <> DBMS_XMLDOM.GETNODEVALUE(DBMS_XMLDOM.GETFIRSTCHILD(DBMS_XMLDOM.ITEM(nodeList, 0))) THEN
    vUE_ID := DBMS_XMLDOM.GETNODEVALUE(DBMS_XMLDOM.GETFIRSTCHILD(DBMS_XMLDOM.ITEM(nodeList, 0)));
    --on ramasse le rst_id
    SELECT RST_ID INTO vRST_ID
    FROM PARITOP_RESULTAT RST
    WHERE RST.PRC_ID = pPRC_ID
    AND RST.UE_ID = vUE_ID
    AND RST.RST_MONDE = pRST_MONDE
    AND RST_A_SUPPRIMER = 0;
    END IF;
    GESTXML_PKG.PARITOP_ADDNODETOROW(XMLDOMDOC, NODE_ROW, 'RST_ID', vRST_ID);
    end loop;
    RESULT_DOC := ' '; --à garder, pour ne pas que ca fasse d'erreur lors du WriteToClob.
    dbms_xmldom.writeToClob(DBMS_XMLDOM.MAKENODE(XMLDOMDOC), RESULT_DOC);
    --Insertion du document XML dans la table "tableName"
    GESTXML_PKG.PARITOP_INSERTXML(RESULT_DOC, pTABLENAME);
    DBMS_XMLDOM.FREEDOCUMENT( XMLDOMDOC);
    end if;
    EXCEPTION
    […exception treatement…]
    END;
    END;
    The format of a XML clob is :
    <ROWSET>
    <ROW>
    <PRC_ID>193</PRC_ID>
    <UE_ID>8781</UE_ID>
    <VEN_ID>6223</VEN_ID>
    <RST_MONDE>0</RST_MONDE>
    <CMP_SELMAN>0</CMP_SELMAN>
    <CMP_INDICESELECTION>92.307692307692307</CMP_INDICESELECTION>
    <CMP_PVRES>94900</CMP_PVRES>
    <CMP_PVAJUSTE>72678.017699115066</CMP_PVAJUSTE>
    <CMP_PVAJUSTEMIN>72678.017699115095</CMP_PVAJUSTEMIN>
    <CMP_PVAJUSTEMAX>72678.017699115037</CMP_PVAJUSTEMAX>
    <CMP_PV>148000</CMP_PV>
    <CMP_VALROLE>129400</CMP_VALROLE>
    <CMP_PVRESECART>4790</CMP_PVRESECART>
    <CMP_PVRHAB>101778.01769911509</CMP_PVRHAB>
    <CMP_UTILISE>1</CMP_UTILISE>
    <CMP_TVM>1</CMP_TVM>
    <CMP_PVA>148000</CMP_PVA>
    </ROW>
    <ROW>
    <PRC_ID>193</PRC_ID>
    <UE_ID>8781</UE_ID>
    <VEN_ID>6235</VEN_ID>
    <RST_MONDE>0</RST_MONDE>
    <CMP_SELMAN>0</CMP_SELMAN>
    <CMP_INDICESELECTION>76.92307692307692</CMP_INDICESELECTION>
    <CMP_PVRES>117800</CMP_PVRES>
    <CMP_PVAJUSTE>118080</CMP_PVAJUSTE>
    <CMP_PVAJUSTEMIN>118080</CMP_PVAJUSTEMIN>
    <CMP_PVAJUSTEMAX>118080</CMP_PVAJUSTEMAX>
    <CMP_PV>172000</CMP_PV>
    <CMP_VALROLE>134800</CMP_VALROLE>
    <CMP_PVRESECART>0</CMP_PVRESECART>
    <CMP_PVRHAB>147180</CMP_PVRHAB>
    <CMP_UTILISE>1</CMP_UTILISE>
    <CMP_TVM>1</CMP_TVM>
    <CMP_PVA>172000</CMP_PVA>
    </ROW>
    </ROWSET>
    PARITOP_COMPARABLE TABLE :
    RST_ID NUMBER(10) NOT NULL,
    VEN_ID NUMBER(10) NOT NULL,
    CMP_SELMAN NUMBER(1) NOT NULL,
    CMP_UTILISE NUMBER(1) NOT NULL,
    CMP_INDICESELECTION FLOAT(53) NOT NULL,
    CMP_PVRES FLOAT(53) NULL,
    CMP_PVAJUSTE FLOAT(53) NULL,
    CMP_PVRHAB FLOAT(53) NULL,
    CMP_TVM FLOAT(53) NULL
    ROCEDURE PARITOP_INSERTXML (xmlDoc IN clob, tableName IN VARCHAR2)
    AS
    insCtx DBMS_XMLSave.ctxType;
    rowss number;
    BEGIN
    --permet d'insérer les champs du XML dans la table passée en paramètre.
    --il suffit que les champs XML aient le même nom que les champs de la table
    BEGIN
    insCtx := DBMS_XMLSave.newContext(tableName); -- get context handle
    DBMS_XMLSAVE.SETDATEFORMAT( insCtx, 'yyyy-MM-dd HH:mm:ss');--attention, case sensitive
    DBMS_XMLSAVE.setIgnoreCase(insCtx, 1);
    rowss := DBMS_XMLSAVE.INSERTXML(insCtx , xmlDoc);
    DBMS_XMLSave.closeContext(insCtx);
    EXCEPTION
    […]
    END;
    END;
    PROCEDURE PARITOP_ADDNODETOROW (
    XMLDOMDOC DBMS_XMLDOM.DOMDOCUMENT,
    NODE_ROW dbms_xmldom.DOMNode,
    NOM_NOEUD VARCHAR2,
    VALEUR_NOEUD VARCHAR2)
    AS
    --PERMET D'AJOUTER UN NOEUD AVEC 1 SEULE VALEUR DANS une ROW D'UN XML.
    --UTILE SURTOUT POUR LES CLÉS ÉTRANGÈRES
    domElemAInserer DBMS_XMLDOM.DOMELEMENT;
    NODE dbms_xmldom.DOMNode;
    NODE_TMP dbms_xmldom.DOMNode;
    BEGIN
    domElemAInserer := DBMS_XMLDOM.createElement(XMLDOMDOC, NOM_NOEUD) ;
    NODE := DBMS_XMLDOM.MAKENODE(domElemAInserer); --cast
    NODE := DBMS_XMLDOM.APPENDCHILD(NODE_ROW,NODE);
    NODE_TMP := DBMS_XMLDOM.MAKENODE(DBMS_XMLDOM.CREATETEXTNODE(XMLDOMDOC, VALEUR_NOEUD ) );
    NODE := DBMS_XMLDOM.APPENDCHILD(NODE,NODE_TMP );
    END;

  • XML Data Load into releational structures

    Hi,
    I am very unexperienced in using XML and have the problem
    to import very large XML data files into existing reletional structures.
    In our production DB we don't use the java engine, so
    that PL/SQL an the SQL Loader are the only available ways to import the data.
    At the moment we get flat files and use the SQL Loader utility. But an interface to a new system send XML data now and I have to fill the same old releational structure with the new data.
    Can anybody give me a hint about the best technic for an high performance import. Are there any existing tools for the relational mapping?
    Regards Ralph

    Thank you for your reply.
    You are right. We only want to break the XML to fill our relational structures. We don't need the XML data further on. But we have to load the data in temporary structures, because we have to transform the data in our own format. (The system which delivers the XML data is external and uses another data model)
    Is there no more elegant way with use of databse built in technics? The XML data we get can be validated against a XML schema.
    So I thought, it could be a way to load the XML in the XDB and register the schema in the database. After that store the XML data in the default generated object relational structures and then programm the data transformation and the data flow between these default structures to our target data structures with PL/SQL.
    I don't know if this way is performant enough.
    If I use an external tool i have to code the relational mapping outside the database and insert the data with use of ODBC in temporary structures which i have to create manualy.
    So I hoped to find a way to load the data in any relational structure using the advantages of XML and XML schema and code the neccasary logic inside the DB.
    Do you have any further hints for my problem?
    Regards Ralph

  • 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

  • Generating structured XML file based on relational data base

    Hi,
    I need to use XML DB to generate a structured XML file based on the relational oracle database. I start by using Oracle default table, emp,
    Here is EMP data,
    EMPNO ENAME DEPNO SAL
    123.00 E1 20.00 1,000.00
    124.00 E2 20.00 2,000.00
    125.00 E3 20.00 2,000.00
    126.00 E4 30.00 3,000.00
    127.00 E5 30.00 3,000.00
    128.00 E6 30.00 4,000.00
    129.00 E7 40.00 7,000.00
    I used this SQL statement to generate an XML output,
    select XMLElement ("Department",
    XMLAttributes(deptno as "DEPARTMENTNO"),
    XMLElement("EmployeeName", ename),
    XMLElement("Salary", sal)
    ) "Result"
    from
    emp
    where
    deptno=20
    The result was
    <Department DEPARTMENTNO="20">
    <EmployeeName>E1</EmployeeName>
    <Salary>1000</Salary>
    </Department>
    <Department DEPARTMENTNO="20">
    <EmployeeName>E2</EmployeeName>
    <Salary>2000</Salary>
    </Department>
    <Department DEPARTMENTNO="20">
    <EmployeeName>E3</EmployeeName>
    <Salary>2000</Salary>
    </Department>
    but I need this structure instead,
    <Department DEPARTMENTNO="20">
    <EmployeeName>E1</EmployeeName>
    <Salary>1000</Salary>
    <EmployeeName>E2</EmployeeName>
    <Salary>2000</Salary>
    <EmployeeName>E3</EmployeeName>
    <Salary>2000</Salary>
    </Department>
    Could you guide me how I can generate this kind of structure like master-detail structure and which document you recommend to obtain this point.
    Thanks,
    Shiva

    Hi,
    If you want to write an xml into file, I think you should use PL/SQL.
    Is it even possible to spool output into file without the query itself?
    doen't show me a proper xml fileTo get well-formed xml, you also have to make a root element.
    If you want <?xml version="1.0"?> also then use xmlroot(), but I haven't figure out
    how to specify the encoding.
    SQL> WITH xtab AS(SELECT 'E1' ename,20 depno,1000 sal FROM dual
      2               UNION ALL
      3               SELECT 'E2',20,2000 FROM dual
      4               UNION ALL
      5               SELECT 'E3',40,3000 FROM dual
      6               UNION ALL
      7               SELECT 'E4',30,4000 FROM dual)
      8  SELECT XMLRoot(XMLElement("Company",XMLAgg(XMLElement("Department",
      9           XMLattributes(depno as "DEPARTMENTNO"),
    10             XMLAgg(XMLForest(
    11                      ename AS "EmployeeName",
    12                      sal   AS "Salary"))))),version '1.0') company_xml
    13  FROM xtab
    14  GROUP BY depno;
    COMPANY_XML                                                                    
    <?xml version="1.0"?>                                                          
    <Company>                                                                      
      <Department DEPARTMENTNO="20">                                               
        <EmployeeName>E1</EmployeeName>                                            
        <Salary>1000</Salary>                                                      
        <EmployeeName>E2</EmployeeName>                                            
        <Salary>2000</Salary>                                                      
      </Department>                                                                
      <Department DEPARTMENTNO="30">                                               
        <EmployeeName>E4</EmployeeName>                                            
        <Salary>4000</Salary>                                                      
      </Department>                                                                
      <Department DEPARTMENTNO="40">                                               
        <EmployeeName>E3</EmployeeName>                                            
        <Salary>3000</Salary>                                                      
      </Department>                                                                
    </Company>
    [pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • XML stored as object relational fails

    We are looking at implementing a system to store Universal Business Language (UBL) 1.0 XML invoices in an XMLType column in 10g. I've registered all the requisite schemas (the UBL invoice comprises a rather complicated hierarchy of 19 individual namespaces), but when I come to create the table:
    CREATE TABLE UBLInvoices (
    invoice_id NUMBER,
    invoice_spec XMLTYPE)
    XMLTYPE invoice_spec STORE AS OBJECT RELATIONAL
    XMLSCHEMA "Invoice-1.0"
    ELEMENT "Invoice";
    I get an error message to the effect that a table with more than 1000 columns cannot be created. I can create the table using CLOB storage (STORE AS CLOB) without any problems. Is there a limit to the complexity of typed XMLType column schema? Is there any workaround?

    As A Non says, why is it unacceptable?
    It's only unacceptable to you, but it's not unacceptable XML. The standard of XML does not require a display format as the purpose of XML is to define a structure of data, not to present itself nicely to you on the screen.
    If you want to prettify your XML, that's up to you, but optimised XML data does not have formatting, which takes up additional and unnecessary storage space.

  • Storing and searching XML in CLOBs

    Speaking to an oracle employee at the Oracle booth at JavaOne
    recently. They suggested I store XML in CLOBs
    and use the DOM or SAX to reparse the XML later as needed.
    I agreed that this was the best solution for my problem
    (which was how to manage many different XML documents using many
    different DTDs in a document management system)
    The big problem was searching this document repository
    to locate relevant information.
    This is where Intermedia seemed ideal (still does).
    It would be nice to see an example of setting this up using
    Intermedia in Oracle 8i, demonstrating how to define the
    XML_SECTION_GROUP and where to use a ZONE as opposed to a FIELD
    etc.
    Anybody care to take a shot at this ????
    For example:
    How would I define Intermedia parameters
    so that I would be able to search my CLOB
    column for records that had the <keyword>
    "aorta" and "damage" in the <caption>
    using the following
    XML (DTD implied)
    <image filename="OurImageName.gif">
    <fname>WellKnownFileName.gif</fname>
    <keyword>echocardiogram</keyword>
    <keyword>aorta</keyword>
    <caption>This is an image of the vessel damage</caption>
    </image>
    Thanks
    Thomas Bennett
    null

    Eric (guest) wrote:
    : You can't do XML structure-based searches with intermedia. You
    : can search for text within a given element, but nothing more
    : complicated than that.
    The example he gave involves exactly that -- searching for
    text within XML elements. interMedia can do this.
    : It also does not do attributes.
    Upcoming 8.1.6 version allows searching within
    attribute text. That's something like:
    dog within book@author
    We're working on attribute value sensitive search,
    more like:
    dog within book[@author = "Eric"]
    : Thomas Bennett (guest) wrote:
    : : How would I define Intermedia parameters
    : : so that I would be able to search my CLOB
    : : column for records that had the <keyword>
    : : "aorta" and "damage" in the <caption>
    : : using the following
    : : XML (DTD implied)
    : : <image filename="OurImageName.gif">
    : : <fname>WellKnownFileName.gif</fname>
    : : <keyword>echocardiogram</keyword>
    : : <keyword>aorta</keyword>
    : : <caption>This is an image of the vessel damage</caption>
    : : </image>
    begin
    ctx_ddl.create_section_group('mygrp','basic_section_group');
    ctx_ddl.add_field_section('mygrp','keyword','keyword');
    ctx_ddl.add_field_section('mygrp','caption','caption');
    end;
    create index myidx on mytab(mytxtcolumn)
    indextype is ctxsys.context
    parameters ('section group mygrp');
    select * from mytab
    where contains(mytxtcolumn, 'aorta within keyword')>0;
    options:
    * use XML section group instead of basic section group
    if your tags have attributes or you need case-sensitive
    tag detection
    * use zone sections instead of field sections if your
    sections overlap, or if you need to distinguish
    between instances. For instance, keywords. If keywords
    is a field section, then
    (aorta and echocardiogram) within keywords
    finds the document. if it is a zone section, then it
    doesn't, because they are not in the SAME instance of
    keywords.
    null

  • XML to complex/deep ABAP structure

    Has anyone successfully used Function module
    SDIXML_DOM_TO_DATA (& related SDIXML* Function modules) to convert XML string into complex ABAP structure?
    I am using WAS 6.40 (ECC) and I was hoping that if the XML & the ABAP structure you pass as function module parameter do match in strcture, then this Function module should automatically convert (ie, de-serialize) the XML into ABAP structure - Without having to write any XSLT or ST (Simple Transformation) files !
    Any ideas? Any other Function module? The ABAP structure I want to be populated is a "deep structure" with many levels and tables at various levels etc..
    Thanks a lot

    Hi Janet Lam,
    Here's an article explaining mapping between XML and ABAP structures.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/2e98a690-0201-0010-3b90-cda224bad152
    Dont forget to reward pts, if it helps ;>)
    Regards,
    Rakesh.

  • XML in clob columns and OWB

    I’m building some ETL process to extract data from XML in CLOB columns. I know that there are solutions to use functions as extractvalue() of WB_XML_LOAD(), but I want to know if there is any other way to deal with XML. The reason for that is because my XML files have multiple namespaces and nodes, and I need something more complex to deal with that, since I already tried those two first solutions.
    My first solution was to create a PL/SQL that parses the XML and looks for tags and elements. It populates a relational table, and I might use OWB to extract the data from this table. But I’m dealing with a large table and it takes a while for processing, plus my code is hude!
    My question is: Does someone have any experience with complex XML in Clob columns? If so, what was your solution for that?
    Thanks a lot!
    Angelo Buss
    [email protected]

    CLOB is a fully-updateable, character large object that is stored inside the database. It can be text-indexed using interMedia for document searching.
    BFILE is a readonly pointer to a file on the external file system whose content is not physically stored in the database. It can also be text-indexed for document searching, but it can't be updated.

  • Migrating V9 to V10: Update XML Fragment CLOB does not work anymore

    I have an XML Schema that contains an element, named Operazione, mapped to a CLOB.
    I just migrate to Oracle 10.1.0.2.0 from version 9.2.0.2.0 and the code I developed does not work anymore.
    To get a CLOB on v 9.2.0.2.0 I issued the following statement:
    select extractValue(value(p),'/operazione.log/Operazione') from XMT_OPERAZIONE_LOG p
    where existsNode(value(p),'/operazione.log/Journal[NumeroElettronico=1234567890]') = 1
    To make it working on V10 I have to change it as follow:
    select extract(value(p),'/operazione.log/Operazione').getClobVal() from XMT_OPERAZIONE_LOG p
    where existsNode(value(p),'/operazione.log/Journal[NumeroElettronico=1234567890]') = 1
    So using extract intead of extractValue and adding getClobVal() I was able to read the CLOB.
    The problem that I was not able to solve is related to CLOB update. In V9 just adding the “for update” clause I was able to change the CLOB value on DB.
    In V10 if I run the V9 statement I get the error:
    ORA-03113: end-of-file on communication channel
    If I use the statement modified for V10, adding the “for update” clause, I get the CLOB and I can change the CLOB value but nothing goes on the DB. Probably I am working on a copy of the DB CLOB.
    If I remove the getClobVal() I get an OPAQUE type that I can use on a XMLType but, still, nothing is stored on DB.
    Any suggestion ?
    I tried with both OCI and Thin Client

    Can anybody help me ?
    Is it better to use different strategies ( eg. Stored Procedure, DBMS_XMLSTORE etc, etc. ) ?
    Any experience updatating XML Fragment CLOB on Oracle V10 ?

  • Simple Transformation to deserialize an XML file into ABAP data structures?

    I'm attempting to write my first simple transformation to deserialize
    an XML file into ABAP data structures and I have a few questions.
    My simple transformation contains code like the following
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates"
                  xmlns:pp="http://www.sap.com/abapxml/types/defined" >
    <tt:type name="REPORT" line-type="?">
      <tt:node name="COMPANY_ID" type="C" length="10" />
      <tt:node name="JOB_ID" type="C" length="20" />
      <tt:node name="TYPE_CSV" type="C" length="1" />
      <tt:node name="TYPE_XLS" type="C" length="1" />
      <tt:node name="TYPE_PDF" type="C" length="1" />
      <tt:node name="IS_NEW" type="C" length="1" />
    </tt:type>
    <tt:root name="ROOT2" type="pp:REPORT" />
        <QueryResponse>
        <tt:loop ref="ROOT2" name="line">
          <QueryResponseRow>
            <CompanyID>
              <tt:value ref="$line.COMPANY_ID" />
            </CompanyID>
            <JobID>
              <tt:value ref="$line.JOB_ID" />
            </JobID>
            <ExportTypes>
              <tt:loop>
                <ExportType>
                   I don't know what to do here (see item 3, below)
                </ExportType>
              </tt:loop>
            </ExportTypes>
            <IsNew>
              <tt:value ref="$line.IS_NEW"
              map="val(' ') = xml('false'), val('X') = xml('true')" />
            </IsNew>
          </QueryResponseRow>
          </tt:loop>
        </QueryResponse>
        </tt:loop>
    1. In a DTD, an element can be designated as occurring zero or one
    time, zero or more times, or one or more times. How do I write the
    simple transformation to accommodate these possibilities?
    2. In trying to accommodate the "zero or more times" case, I am trying
    to use the <tt:loop> instruction. It occurs several layers deep in the
    XML hierarchy, but at the top level of the ABAP table. The internal
    table has a structure defined in the ABAP program, not in the data
    dictionary. In the simple transformation, I used <tt:type> and
    <tt:node> to define the structure of the internal table and then
    tried to use <tt:loop ref="ROOT2" name="line"> around the subtree that
    can occur zero or more times. But every variation I try seems to get
    different errors. Can anyone supply a working example of this?
    3. Among the fields in the internal table, I've defined three
    one-character fields named TYPE_CSV, TYPE_XLS, and TYPE_PDF. In the
    XML file, I expect zero to three elements of the form
    <ExportType exporttype='csv' />
    <ExportType exporttype='xls' />
    <ExportType exporttype='pdf' />
    I want to set field TYPE_CSV = 'X' if I find an ExportType element
    with its exporttype attribute set to 'csv'. I want to set field
    TYPE_XLS = 'X' if I find an ExportType element with its exporttype
    attribute set to 'xls'. I want to set field TYPE_PDF = 'X' if I find
    an ExportType element with its exporttype attribute set to 'pdf'. How
    can I do that?
    4. For an element that has a value like
    <ErrorCode>123</ErrorCode>
    in the simple transformation, the sequence
    <ErrorCode>  <tt:value ref="ROOT1.CODE" />  </ErrorCode>
    seems to work just fine.
    I have other situations where the XML reads
    <IsNew value='true' />
    I wanted to write
    <IsNew>
            <tt:value ref="$line.IS_NEW"
            map="val(' ') = xml('false'), val('X') = xml('true')" />
           </IsNew>
    but I'm afraid that the <tt:value> fails to deal with the fact that in
    the XML file the value is being passed as the value of an attribute
    (named "value"), rather than the value of the element itself. How do
    you handle this?

    Try this code below:
    data  l_xml_table2  type table of xml_line with header line.
    W_filename - This is a Path.
      if w_filename(02) = '
        open dataset w_filename for output in binary mode.
        if sy-subrc = 0.
          l_xml_table2[] = l_xml_table[].
          loop at l_xml_table2.
            transfer l_xml_table2 to w_filename.
          endloop.
        endif.
        close dataset w_filename.
      else.
        call method cl_gui_frontend_services=>gui_download
          exporting
            bin_filesize = l_xml_size
            filename     = w_filename
            filetype     = 'BIN'
          changing
            data_tab     = l_xml_table
          exceptions
            others       = 24.
        if sy-subrc <> 0.
          message id sy-msgid type sy-msgty number sy-msgno
                     with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        endif.

  • Not able to create XML from an existing relational database

    Hi,
    I am trying to create and xml from an existing relational database. I am not able to get any XML data, I receive "XMLTYPE()" as the result.
    Here's the query -
    SQL> select o.order_id, XMLELEMENT("order", XMLATTRIBUTES(o.order_id as ID)) AS "result" from order_
    info o where order_id=2793;
    ORDER_ID
    result()
    +2793+
    XMLTYPE()
    I was expecting to get +<order id=2793 />+ instead of XMLTYPE().
    I am using -
    SQLPlus: Release 9.0.1.0.1*
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    I have also run some checks to confirm XML DB installation -
    SQL> select 1 from all_users where username  = 'XDB';
    +1+
    +1+
    SQL> desc RESOURCE_VIEW;
    Name                                      Null?    Type
    RES                                                SYS.XMLTYPE
    ANY_PATH                                           VARCHAR2(4000)
    RESID                                              RAW(16)
    I think, I have something wrong with installation or configuration.
    Any idea about what have I done wrong here?

    Works fine now. Got the result "<order ID="2793"></order>".
    Thanks. :-)

  • SQL Server 2012 Management Studio: XML XQuery-query the XML Blob using CTE: How to specify the coorelation name in bulk rowset?

    Hi all,
    I just started doing the XML Xquery programming in my SQL Server 2012 Management Studio. I executed the following code:
    --query the XML Blob using a CTE (pulling from the XML file each time) Products
    WITH XmlFile (Contents) AS (
    SELECT CONVERT (XML, BulkColumn)
    FROM OPENROWSET (BULK 'H:\Products.xml', SINGLE_BLOB) ) AS XmlData
    SELECT *
    FROM XmlFile
    GO
    I got the the following Msg:
    Msg 491, Level 16, State 1, Line 4
    A correlation name must be specified for the bulk rowset in the from clause.
    How can I specify the correction name for the bulk rowset in my project?
    Please kindly help, advise and respond.
    Thanks in advance,
    Scott Chang

    Hello Scott,
    You have to assign a table alias for the OPENROWSET =>
    --query the XML Blob using a CTE (pulling from the XML file each time) Products
    WITH XmlFile (Contents) AS (
    SELECT CONVERT (XML, BulkColumn)
    FROM OPENROWSET (BULK 'H:\Products.xml', SINGLE_BLOB) AS MyXML ) AS XmlData
    SELECT *
    FROM XmlFile
    GO
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • ORA-22275 :invalid LOB locator specified error while loading BLOBs/CLOBS.

    Hello All,
    I am trying to load BLOB/CLOB data from a client oracle DB to the oracle db on our side,we are using ODI version 10.1.3.5.6,which reportedly has the issue of loading BLOB/CLOBS solved.I am using
    The extraction fails in the loading stage when inserting data into the C$ table with the following error.
    "22275:99999 :java.sql.BatchUpdateException:ORA-22275:Invalid LOB locator specified".
    Kindly let me know how I can resolve this issue as the requirement to load this data is very urgent.
    Thanks,
    John

    One alternate way can be done out of ODI as ODI is still not able to resolve this issue. You can trim these fields (CLOB/BLOB) and push this data as separate fields into ODI and at the reporting end you can again concatenate them.
    May be this may solve your problem ....it solved mine.
    --XAT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • Can Lion be installed on an iMac with a Dual Core processor?

    I have an older iMac, model iMac4,1 with an Intel 2.0 GHz Core Duo Processor, 2 GBytes of 667 MHz DDR2 SDRAM.  It is currently running Mac OS X version 10.6.8 and works very well. I've seen conflicting information about the system requirements for up

  • Itunes on windows 7 not recognising i-phone5

    I have an acer aspire windows 7 laptop that does not have any software on it and i downloaded i-tunes onto it but it does not recognise my i-phone5, what could be the problem?

  • Firefox crashes everytime I open a .pdf file

    Everytime I open a pdf file with firefox it crashes. Any ideas? Here is the crash log: Date/Time: 2007-08-05 13:29:44.445 -0700 OS Version: 10.4.10 (Build 8R218) Report Version: 4 Command: firefox-bin Path: /Applications/Firefox.app/Contents/MacOS/fi

  • Installing business content for 0MKT_DSO1/0CRM_LEAD_H

    Hi I am getting an error whilst installing the business content for any DSO/Infocube. Grouping In data flow before. Error : Rule (target: 0GN_PAR_LSY, group: 01 Standard Group): Syntax error in routine where as same DSO whilst acitivated wiht diff so

  • AFAB ABAP runtime error  SAPSQL_ARRAY_INSERT_DUPREC

    Hi, Please, can somebody help me? When running AFAB for period 08 2009, the job gets cancelled and the job log says: The ABAP/4 Open SQL array insert results in duplicate database records. If you use an ABAP/4 Open SQL array insert to insert a record