XML in CLOB or BFILE

Could somebody tell me the different between save XML in CLOB and BFILE, addition to generic different between CLOB and BFILE, is there a performance issue?
Thanks

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.

Similar Messages

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

  • 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

  • Extract part of xml into CLOB or XMLType

    I need to extract part of XML into CLOB or some another type. But I don't need only extract data, by whole part od xml with elements. How could I do it in PL/SQL?
    For example from this xml:
    <bookstore>
    <book category="COOKING">
    <title lang="en">Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
    </book>
    <book category="CHILDREN">
    <title lang="en">Harry Potter</title>
    <author>J K. Rowling</author>
    <year>2005</year>
    <price>29.99</price>
    </book>
    </bookstore>
    I need to get:
    "<book category="COOKING">
    <title lang="en">Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
    </book>"
    THX

    That's why I need to process every book alone - to know which authors belongs to single book.For that specific requirement, a single query would do.
    Assuming variable "v_xml_clob" holds the XML document :
    <bookstore>
      <name>nameOfBookstore</name>
      <address>1st Avenue 24, SF</address>
          <book category="COOKING">
            <title lang="en">Everyday Italian</title>
            <author>
              <name>Giada De Laurentiis</name>
              <birth>1956</birth>
            </author>
            <author>
              <name>xxx</name>
              <birth>1955</birth>
            </author>
            <year>2005</year>
            <price>30.00</price>
          </book>
          <book category="CHILDREN">
            <title lang="en">Harry Potter</title>
            <author>
              <name>Rowning</name>
              <birth>1977</birth>
            </author>
            <author>
              <name>xxx</name>
              <birth>1955</birth>
            </author>
            <year>2005</year>
            <price>29.99</price>
          </book>
    </bookstore>You can do :
    SELECT *
    FROM XMLTable(
    'for $i in distinct-values($d//book/author/name)
      where count($d//book/author[name=$i]) = 1
      return $i'
    passing xmltype(v_xml_clob) as "d"
    columns author_name varchar2(80) path '.'
    AUTHOR_NAME
    Rowning
    Giada De Laurentiis

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

  • Parse XML from CLOB field

    How can I parse XML from CLOB field? I need to replace or delete the node from XML document and update the database with new XML. I am using Oracle 9i release 2.
    Here is the XML. In this XML if section1 and section2 exists then I need to delete the section1 node. If section2 doesn't exist, replace section1 with section2 node.
    <Document ID='2' TypeID='2'>
    <Body>
    <Page Name='Page1'>
    <Sec ID='section1' Title='Section 1' GroupID='' />
    <Sec ID='section2' Title='Section 2' GroupID='' />
    </Page>
    </Body>
    </Document>
    Please help.. Thank you..

    In 9.2, you are limited into your options. Have a look into, among others, updateXML. Updating tp 10gR2 will give you more options to succeed.

  • Query to read XML from CLOB table column

    Hi
    I want an SQL to get the following information extract from a CLOB table column.
    MasterReport/sg:RptDef/sg:RptCell@RealDesc MasterReport/sg:RptDef/sg:RptCell@RealNum
    credits                              100
    debits                              100
    Sample XML data from table column is:
    <?xml version="1.0" encoding="UTF-8" ?>
    <MasterReport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sg="http://www.oracle.com/fsg/2002-03-20/" xsi:schemaLocation="http://www.oracle.com/2002-03-20/fsg.xsd">
    <sg:LDGName>Vision Portugal</sg:LDGName>
    <sg:SOBName>Vision Portugal</sg:SOBName>
    <sg:DataAccessSetName>Vision Portugal</sg:DataAccessSetName>
    <sg:InternalReportName>Model 30 Report</sg:InternalReportName>
    <sg:CustomParam10 />
    <sg:RowContext RowId="r100001">
    <sg:RowName />
    <sg:RowLineItem>Litigation Credits- Total amount from previous period</sg:RowLineItem>
    <sg:RowDispUnit>1</sg:RowDispUnit>
    <sg:RowDispFormat />
    <sg:RowUnitOfMeasure>EUR</sg:RowUnitOfMeasure>
    <sg:RowLedgerCurrency>ANY</sg:RowLedgerCurrency>
    <sg:RowCurrencyType>T</sg:RowCurrencyType>
    <sg:RowChangeSign>0</sg:RowChangeSign>
    <sg:RowSeq>1.0000000000000</sg:RowSeq>
    </sg:RowContext>
    <sg:RowContext RowId="r100002">
    <sg:RowName />
    <sg:RowLineItem>Litigation credits- Taxed amounts from column2 for Previous period</sg:RowLineItem>
    <sg:RowDispUnit>1</sg:RowDispUnit>
    <sg:RowDispFormat />
    <sg:RowUnitOfMeasure>EUR</sg:RowUnitOfMeasure>
    <sg:RowLedgerCurrency>ANY</sg:RowLedgerCurrency>
    <sg:RowCurrencyType>T</sg:RowCurrencyType>
    <sg:RowChangeSign>0</sg:RowChangeSign>
    <sg:RowSeq>2.0000000000000</sg:RowSeq>
    </sg:RowContext>
    <sg:ColContext ColId="c1000">
    <sg:ColAmountType />
    <sg:ColPeriod />
    <sg:ColPerOffset />
    <sg:ColChangeSign />
    <sg:ColPosition />
    <sg:ColSeq />
    <sg:ColWidth>100</sg:ColWidth>
    </sg:ColContext>
    <sg:ColContext ColId="c1001">
    <sg:ColName>Total</sg:ColName>
    <sg:ColDescr />
    <sg:ColDispUnit>1</sg:ColDispUnit>
    <sg:ColUnitOfMeasure>EUR</sg:ColUnitOfMeasure>
    <sg:ColLedgerCurrency>ANY</sg:ColLedgerCurrency>
    <sg:ColCurrencyType>T</sg:ColCurrencyType>
    <sg:ColDispFormat>999999999.99</sg:ColDispFormat>
    <sg:ColAmountType>YTD-Actual</sg:ColAmountType>
    <sg:ColPerOffset>0</sg:ColPerOffset>
    <sg:ColAmntId>14</sg:ColAmntId>
    <sg:ColParamId>-1</sg:ColParamId>
    <sg:ColType>A</sg:ColType>
    <sg:ColStyle>B</sg:ColStyle>
    <sg:ColPeriod>10-08</sg:ColPeriod>
    <sg:ColPeriodYear>2008</sg:ColPeriodYear>
    <sg:ColPeriodNum>11</sg:ColPeriodNum>
    <sg:ColPeriodStart>2008-10-01T00:00:00</sg:ColPeriodStart>
    <sg:ColPeriodEnd>2008-10-31T00:00:00</sg:ColPeriodEnd>
    <sg:ColChangeSign>0</sg:ColChangeSign>
    <sg:ColHeadLine1>Totals</sg:ColHeadLine1>
    <sg:ColHeadLine2 />
    <sg:ColHeadLine3 />
    <sg:ColHeadLine4 />
    <sg:ColHeadLine5 />
    <sg:ColHeadLine6 />
    <sg:ColHeadLine7 />
    <sg:ColHeadLine8 />
    <sg:ColHeadLine9 />
    <sg:ColPosition>99</sg:ColPosition>
    <sg:ColSeq>1.0000000000000</sg:ColSeq>
    <sg:ColWidth>14</sg:ColWidth>
    </sg:ColContext>
    <sg:RptDef RptId="p1001" RptDetName="Ledger=Vision PT (Vision Portugal)" RptPESegm="" RptPEVal="" RptTabLabel="Output 1 (Vision PT)">
    <sg:RptLine RptCnt="p1001" RowCnt="r100001" LineRowSeq="1.0000000000000" LinCnt="l100001">
    <sg:RptCell ColCnt="c1000" RealDesc="debits">debits</sg:RptCell>
    <sg:RptCell ColCnt="c1001" RealNum="100.000000">100.00</sg:RptCell>
    </sg:RptLine>
    <sg:RptLine RptCnt="p1001" RowCnt="r100002" LineRowSeq="2.0000000000000" LinCnt="l100002">
    <sg:RptCell ColCnt="c1000" RealDesc="creditsd">credits</sg:RptCell>
    <sg:RptCell ColCnt="c1001" RealNum="100.000000">100.00</sg:RptCell>
    </sg:RptLine>
    </sg:RptDef>
    <sg:TabCount>1</sg:TabCount>
    </MasterReport>
    Please help me.
    Regards
    Giri
    Edited by: user576087 on Mar 18, 2012 11:54 PM

    I'm not sure if you want the values from the attribute or the element, but this should give you a good start :
    SQL> alter session set nls_numeric_characters = ".,";
    Session altered
    SQL>
    SQL> select x.*
      2  from my_table t
      3     , xmltable(
      4         xmlnamespaces('http://www.oracle.com/fsg/2002-03-20/' as "sg")
      5       , '/MasterReport/sg:RptDef/sg:RptLine'
      6         passing xmltype(t.xmldoc)
      7         columns type    varchar2(30) path 'sg:RptCell[1]'
      8               , amount  number       path 'sg:RptCell[2]'
      9       ) x
    10  ;
    TYPE                               AMOUNT
    debits                                100
    credits                               100

  • XML Publisher CLOBS Help !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    Can someone please help ..
    I am trying to display a clob field that contains just random text but when i run my xml definition on concurrant manager xdodtexe the field is displayed as blank,
    Does anyone know how i can display this clob field on my report template or is there a way to display it through my xml template using some kind of function... in the sql
    I am just selecting 4 Clob fields from a oracle table.
    xml publisher 5
    Oracle Apps 11
    Cheers
    Sharky

    Yeah simple select in xml definition file as below - Im getting a error when using getclobval()
    Error Not an object or Ref - Code Ora-22806
    Any Ideas
    -- start of code
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <dataTemplate name="VAC_ADVERTISED" version="1.0">
    <parameters/>
    <dataQuery>
    <sqlStatement name="Q1">
    <![CDATA[SELECT   iv.vacancy_name,
    pv.attribute_category vacancy_type,
             iv.professional_area,
             iv.number_of_openings,
             iv.grade_name,
             TO_CHAR (pra.date_start, 'DD-MON-RRRR') VACANCY_START_DATE,
             TO_CHAR (pra.date_end, 'DD-MON-RRRR') VACANCY_END_DATE,
             ipcv.job_title, ipcv.org_name,
             hra.derived_locale LOCATION,
             hl.meaning route_area_teri,
             hl2.meaning grade_band,
             iv.recruiter_name,
             iv.manager_name
            , ipcv.org_description.getClobval() DEP_DESC
            , ipcv.brief_description.getClobval() BRF_DESC
            ,ipcv.detailed_description.getClobval() DET_DESC
             ,ipcv.additional_details.getClobval() HTAI
        FROM ircfv_vacancies iv,
             per_vacancies pv,
             per_positions pp,
             per_position_definitions ppd,
             per_jobs pj,
             per_job_definitions pjd,
             per_recruitment_activity_for praf,
             per_recruitment_activities pra,
             irc_all_recruiting_sites iars,
             irc_posting_contents_vl ipcv,
             per_recruitment_activity_for praf_ext,
             per_recruitment_activities pra_ext,
             irc_all_recruiting_sites iars_ext,
             irc_search_criteria isc,
             hr_lookups hl,
             hr_lookups hl2,
             hr_lookups hl3,
             hr_locations_all hra
       WHERE iv.vacancy_status = 'Approved'
         AND pp.position_id(+) = iv.position_id
         AND ppd.position_definition_id(+) = pp.position_definition_id
         AND pj.job_id(+) = iv.job_id
         AND pjd.job_definition_id(+) = pj.job_id
         AND praf.vacancy_id = iv.vacancy_id
         AND praf.recruitment_activity_id = pra.recruitment_activity_id
         AND pra.recruiting_site_id = iars.recruiting_site_id
         AND pra.posting_content_id = ipcv.posting_content_id
         AND iars.internal = 'Y'
         AND praf_ext.vacancy_id = iv.vacancy_id
         AND praf_ext.recruitment_activity_id = pra_ext.recruitment_activity_id
         AND pra_ext.recruiting_site_id = iars_ext.recruiting_site_id
         AND iars_ext.EXTERNAL = 'Y'
         AND iv.vacancy_id = isc.object_id(+)
         AND isc.object_type(+) = 'VACANCY'
         AND isc.attribute1 = hl.lookup_code(+)
         AND hl.lookup_type(+) = 'NR_RECRUIT_AREAS'
         AND iv.vacancy_id = isc.object_id(+)
         AND isc.object_type(+) = 'VACANCY'
         AND isc.attribute2 = hl2.lookup_code(+)
         AND hl2.lookup_type(+) = 'NR_RECRUIT_GRADE_BAND'
         AND isc.object_type(+) = 'VACANCY'
         AND isc.attribute3 = hl3.lookup_code(+)
         AND hl3.lookup_type(+) = 'NR_RECRUIT_JOB_TYPE'
         AND pv.vacancy_id(+) = iv.vacancy_id
         AND iars.site_name = 'iRecruitment Internal Site'
         AND iars_ext.site_name = 'iRecruitment External Site'
         AND pv.location_id = hra.location_id
    and  trunc(PRA.date_start) between trunc(sysdate,'IW') and TRUNC(SYSDATE)]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="VACANCY_INFO" source = "Q1">
    <element name="VACANCY_NAME" value ="VACANCY_NAME"/>
    <element name="PROFESSIONAL_AREA" value ="PROFESSIONAL_AREA"/>
    <element name="ORG_NAME" value ="ORG_NAME"/>
    <element name="LOCATION" value ="LOCATION"/>
    <element name="RECRUITER_NAME" value ="RECRUITER_NAME"/>
    <element name="MANAGER_NAME" value ="MANAGER_NAME"/>
    <element name="DEP_DESC" value ="DEP_DESC"/>
    <element name="BRF_DESC" value ="BRF_DESC"/>
    <element name="DET_DESC" value ="DET_DESC"/>
    <element name="HTAI" value ="HTAI"/>
    </group>
    </dataStructure>
    </dataTemplate>
    -- end of xml file

  • 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

  • Parsing xml in clob field remove non utf-8 characters

    hi all,
    i have an issue where a stored procedure runs during a nightly process and parses xml contained in a clob field. There are some records that contain non-utf8(they paste characters from word)characters and therefore the parse fails when using performing an xquery select against the clob field as xmltype. I was wondering if anyone knew of a handy way to handle such a situation? I have looked around a bit and not found anything that seemed tailored to my situation, and I would like something a bit more generic than doing a replace on individual characters that i have found causing issues...thx in advance! -- jp

    Hi,
    Like BluShadow I'm curious to see a test case...
    Depending on the way it's been created, the encoding declared in the XML prolog doesn't necessarily reflects the actual encoding of the content.
    What's your database character set, and version?
    Please also post the error message you get (LPX-00200 probably?).

  • Query data on an XML table CLOB

    Hi
    I'd like to query an Oracle table to extract xml attributes on xml CLOB column's please see below table structure and how can i improve performance on this table we've already created Index.
    Can you please assist on how to improve performance when querying this table and is there a better way of Querying this table??
    Any suggestion's a welcomed.
    DB version: 11.2.0.1.0
    Table Structure
    CREATE TABLE XXCUSTOM.XXWSF_AR_INTEGRATION_LOG
      ID              NUMBER,
      TIME_RECIEVED   DATE                          DEFAULT SYSDATE,
      INPUT_MESSAGE   CLOB,
      RETURN_MESSAGE  CLOB
    CREATE INDEX APPS.TIME_RECEIVED_IDX ON XXCUSTOM.XXWSF_AR_INTEGRATION_LOG
    (TIME_RECIEVED)
    CREATE UNIQUE INDEX XXCUSTOM.XXWSF_AR_INTEGRATION_LOG_PK ON XXCUSTOM.XXWSF_AR_INTEGRATION_LOG
    (ID)This is my xml on my input_message CLOB column and this table contain more that *700,000 records(row)*
    <AR-Message-Customer arDocumentPrimaryKey="5634300">
    <Customer Customer-Number="AUDJOH0000002" Cusomter-Name="AUDI JOHANNESBURG " Address-1="55 BERTHA STREET " Address-2=" " Address-3="BRAAMFONTEIN " Postal-Code="2017" City-Or-Town="JOHANNESBURG " Country="ZAF" Bank-Name="FIRST NATIONAL BANK " Bank-Account-Num="62116103988" Bank-Account-Description="WSF" Bank-Account-Name="BRETT HUDSON (PTY) LTD " Branch-Name="JOHANNESBURG BRANCH " Branch-Num="251305" Bank-Account-Start-Date="09/08/13 00:00" Org-Id="3010" Customer-Site-Name="34322">
    <Invoice-Lines Customer-Number="AUDJOH0000002" Amount="4457.83" Amount-Includes-Tax-FLag="N" Currency-Code="ZAR" Document-Number="5634285" Invoice-Number="5634285" Invoice-Date="2011-03-31" Line-Number="1" Line-Type="LINE" Org-Id="3010" Quantity="1" Tax-Code="EXEMPT" Tax-Rate="0" Payment-Method="INTERNAL_TRANSFER" Company="3010" R-Company="3010" Joint-Venture="WB" R-Joint-Venture="00000" Contract="X11471=4" R-Contract="0000000" R-Dealer="AUDJOH0000002" Cost-Centre="1370000" R-Cost-Centre="1370000" Account-Code="4317301" R-Account-Code="1317310" Supplier="AUDJOH0000002" Dealer="AUDJOH0000002" Create-Invoice-Flag="N" R-Supplier="AUDJOH0000002" Customer-Site-Name="34322"/>
    <Invoice-Lines Customer-Number="AUDJOH0000002" Amount="0.00" Amount-Includes-Tax-FLag="N" Currency-Code="ZAR" Document-Number="5634285" Invoice-Number="5634285" Invoice-Date="2011-03-31" Line-Number="2" Line-Type="TAX" Link-To-Line-Attribute1="1" Org-Id="3010" Quantity="1" Tax-Code="EXEMPT" Tax-Rate="0" Payment-Method="INTERNAL_TRANSFER" Company="3010" R-Company="3010" Joint-Venture="WB" R-Joint-Venture="00000" Contract="X11471=4" R-Contract="0000000" R-Dealer="AUDJOH0000002" Cost-Centre="1370000" R-Cost-Centre="1370000" Account-Code="2221675" R-Account-Code="2221675" Supplier="AUDJOH0000002" Dealer="AUDJOH0000002" Create-Invoice-Flag="N" R-Supplier="AUDJOH0000002" Customer-Site-Name="34322"/>
    <Invoice-Lines Customer-Number="AUDJOH0000002" Amount="2113.16" Amount-Includes-Tax-FLag="N" Currency-Code="ZAR" Document-Number="5634285" Invoice-Number="5634285" Invoice-Date="2011-03-31" Line-Number="3" Line-Type="LINE" Org-Id="3010" Quantity="1" Tax-Code="EXEMPT" Tax-Rate="0" Payment-Method="INTERNAL_TRANSFER" Company="3010" R-Company="3010" Joint-Venture="WB" R-Joint-Venture="00000" Contract="X27206=3" R-Contract="0000000" R-Dealer="AUDJOH0000002" Cost-Centre="1370000" R-Cost-Centre="1370000" Account-Code="4317301" R-Account-Code="1317310" Supplier="AUDJOH0000002" Dealer="AUDJOH0000002" Create-Invoice-Flag="N" R-Supplier="AUDJOH0000002" Customer-Site-Name="34322"/>
    </Customer>
    </AR-Message-Customer>I'm currently using the below Query but it's not helpful in terms of perfomance.
    select id,extractValue(value(line),'/Invoice-Lines/@Amount') line_Amount,
           extractValue(value(line),'/Invoice-Lines/@Amount-Includes-Tax-FLag') Amount_Includes_Tax_FLag,
           extractValue(value(line),'/Invoice-Lines/@Currency-Code') Currency_Code,
           extractValue(value(line),'/Invoice-Lines/@Document-Number') Document_Number,
           extractValue(value(line),'/Invoice-Lines/@Invoice-Number') Invoice_Number,
           extractValue(value(line),'/Invoice-Lines/@Invoice-Date') Invoice_Date,
           extractValue(value(line),'/Invoice-Lines/@Line-Number') Line_Number,
           extractValue(value(line),'/Invoice-Lines/@Line-Type') Line_Type,
           extractValue(value(line),'/Invoice-Lines/@Link-To-Line-Attribute1') Link_To_Line_Attribute1,
           extractValue(value(line),'/Invoice-Lines/@Org-Id') Org_Id,
           extractValue(value(line),'/Invoice-Lines/@Tax-Code') Tax_Code,
           extractValue(value(line),'/Invoice-Lines/@Tax-Excempt-Flag') Tax_Excempt_Flag,
           extractValue(value(line),'/Invoice-Lines/@Tax-Excempt-Number') Tax_Excempt_Number,
           extractValue(value(line),'/Invoice-Lines/@Tax-Excempt-Reason-Code') Tax_Excempt_Reason_Code,
           extractValue(value(line),'/Invoice-Lines/@Tax-Rate') Tax_Rate,
           extractValue(value(line),'/Invoice-Lines/@Payment-Method') Payment_Method,
           extractValue(value(line),'/Invoice-Lines/@Company') Company,
           extractValue(value(line),'/Invoice-Lines/@R-Company') R_Company,
           extractValue(value(line),'/Invoice-Lines/@Joint-Venture') Joint_Venture,
           extractValue(value(line),'/Invoice-Lines/@R-Joint-Venture') R_Joint_Venture,
           extractValue(value(line),'/Invoice-Lines/@Contract') Contract,
           extractValue(value(line),'/Invoice-Lines/@R-Contrac') R_Contrac,
           extractValue(value(line),'/Invoice-Lines/@R-Dealer') R_Dealer,
           extractValue(value(line),'/Invoice-Lines/@Cost-Centre') Cost_Centre,
           extractValue(value(line),'/Invoice-Lines/@R-Cost-Centre') R_Cost_Centre,
           extractValue(value(line),'/Invoice-Lines/@Account-Code') Account_Code,
           extractValue(value(line),'/Invoice-Lines/@R-Account-Code') R_Account_Code,
           extractValue(value(line),'/Invoice-Lines/@Supplier') Supplier,
           extractValue(value(line),'/Invoice-Lines/@Dealer') Dealer,
           extractValue(value(line),'/Invoice-Lines/@Create-Invoice-Flag') Create_Invoice_Flag,
           extractValue(value(line),'/Invoice-Lines/@R-Supplier') R_Supplier
    from XXWSF_AR_INTEGRATION_LOG a,
         table(XMLSequence(extract(xmltype(input_message),'/AR-Message-Customer/Customer/Invoice-Lines'))) line
    where id = 4123;Thanks
    Lethu

    I'm currently using the below Query but it's not helpful in terms of perfomance.How do you measure "performance"? Response time? System resources used?
    What performance are you expecting vs. what you're currently observing?
    If you're always accessing the table through its unique index, there shouldn't be any performance issue in accessing the table.
    Is the XML you posted a typical document you have in the table? In terms of size?
    Parsing a document that small shouldn't be an issue either whatever the method used.
    Anyway, as Alex said, an optimal storage model would use an XMLType column (binary XML or schema-based object-relational model) instead of CLOB.

  • How to insert huge XML in CLOB using insert command in sql*plus....

    How to upload huge XML into a CLOB column of a normal table using a script?
    A simple insert statement does not seem to work.
    Thanks & regards.

    In SQL *Plus i'm trying to insert directly into the table.
    My insert statement is like below :
    Insert into ui_templates
    (TEMPLATE_ID, TEMPLATE_NAME, CUSTOMER_ID, DESCRIPTION, XML_CONTENT)
    Values
    (1, 'Default', 1, 'Main Default Template', '<?xml version="1.0" encoding="utf-8"?><xoraLayout:Layout name="MyLayout" version="1.0" ................<3357> chars long');
    COMMIT;
    Message was edited by:
    DKar

  • 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

  • Storing XML as CLOBs

    Can anyone give me some input on how to
    store XML files as CLOBs in an Oracle database, preferably using jdbc through jsp pages?
    null

    Hello Michael,
    I believe the reference in the demo tutorial is to Insert process (not function). This is probably the process defined on page 8-6, step 4a of the "Create a process to insert information" section.
    Basically you can upload and store files in CLOB. For my self, I only did it with XML files, but I don't see any reason not to do it with other types of files.
    I think that in order to work with non-structured files (like ASCII) you should learn more about Oracle Text. Apex is also using this product. Search this forum for "oracle text" and continue from there.
    Hope this helps,
    Arie.

  • Retrieve the large volume XML in CLOB

    If I store the larage volume XML documents
    in the database CLOB field,
    How can I retreive the corresponding XML file
    efficently?
    null

    The Dynamic News sample app shows some techniques for working with XML documents and CLOB fields.
    Regards,
    -rh

Maybe you are looking for

  • Can I upgrade iCloud storage using iTunes cards for payment?

    I have chosen not to use my credit card in conjunction with my AppleID, so I purchase all of my apps and media using iTunes cards.  Can I pay for upgraded iCloud storage using iTunes credits?  I would prefer to pay one year at a time using those cred

  • Creation of new employment status

    Hi, We want to create new Employment Status similar to "0" - Withdrawn.  This status should have same features like status "0". I have created a new status "4" and assigned the same to an action. However, the attributes of the new status "4" are not

  • Problems with library on external HD

    I recently moved my entire itunes library to an external HD. It worked very well for a few weeks but now my mac is not able to recognize the drive. I tried to repair the problem using disk utility but was not able to. I was then prompted to back up a

  • What's the best way to create sub-totals & grand-total in SQL2008 R2 (and beyond)?

    What is the easiest way to get sub totals and a grand total on data that is being grouped?  It looks like RollUp might work, but it's being depreciated. My query is: SELECT COMPANY ,INVSTR_CD ,STATE_C ,SUM(CO_SHARE_TOTBAL) as CO_SHARE_TOTBAL FROM #AS

  • ECC 6.0 Enhancement Pack 5 upgrade phase ADJUSTCHK faillure

    When I run the Enhancement Pack Installation, I get a hard failure at the MAIN_SHDCRE/ADJUSTCHK phase.  The error message says "No lines found in logfile matching "UMODPRO\.INX".  The log follows... 1 ETQ201 Entering upgrade-phase "ADJUSTCHK" ("20111