XML extracting

hello,
I'm trying to get some values from XML file, but
unsuccessfully. I have attached the file. I'm not familiar with XML
and don't know what to say more. Have You any ideas??
Thanks in advance.
d.acha

Hal B.
Thanks for the response.
I have used XmlParse
<cfset mydoc = XmlParse(wer.filecontent)>
but I have problems with XmlSearch
Can You pls. help me to find, for example, parameters
"#GGAF_STREET_NAME#" and "#GGDE_DD_SCORE1#" with XmlSearch??
Thanks,
D.

Similar Messages

  • Create a large XML extract from relational tables - 10g

    The Oracle 10g documentation recommends using the various SQL functions such as XMLAGG,XMLELEMENT or DBMS_XMLGEN under chapter "16 Generating XML Data from the Database" for generating a XML extract file. The DBMS_XMLDOM seems like a useful structured package to create a XML formatted extract. Any idea why Oracle does not recommend the use of XMLDOM API ? Are there performance issues or likely de-support ?
    Whats the best way to produce a large XML extract?
    Thanks.

    mdrake wrote:
    No reason not to use it. It just tends to require a lot more coding than the other methods. Underneath the covers they all map into the same code-line. In general, to generate a given XML document you wlll write far fewer lines of code using the SQL/XML operators. Less Code written = less code to maintan = faster time to market.Less code to parse...?

  • Using XML extraction from Oracle and XSLT data transformation

    Hi
    How can transfer data ie: Using XML extraction from Oracle and XSLT data transformation with java application?
    usually i use to do querying sql, getting data from table assinging to model class then send it to UI. how can i go for XML extraction form oracle?
    thanks

    Sorry, I don't understand what exactly you want to do. And I'm under the impression that you might not know exactly what you want to do as well. Could you explain a bit more detailed what you want to achieve?

  • XML extract error

    Hello -
    This is my table:
    SQL> describe UCCNET_REGISTRY_CAT_ITEM;
    Name Null? Type
    UCCNET_REGISTRY_CAT_ITEM_KEY NOT NULL NUMBER
    XML XMLTYPE
    EAN_UCC_PROXY_KEY NUMBER
    DOCUMENT_NAME VARCHAR2(256)
    SQL>
    and this is my statement that is supposed to extract the XML data:
    select p.XML
    from UCCNET_REGISTRY_CAT_ITEM p
    where p.XML.extract('/item/text()').getStringVal = '123';
    I did it exactly as the Oracle Viewlet showed it to me but I got this error:
    where p.XML.extract('/item/text()').getStringVal = '123'
    ERROR at line 3:
    ORA-22806: not an object or REF
    Could you please tell me wher I went wrong?
    Thanks,
    Peter

    I just hit something else on top of my previous problem with XML namespaces. I am trying to pass my XML document to a stored procedure and I seem to be hitting a length limit for a parameter.
    Here's my SP:
    create or replace procedure TEST_UCCnet_Add_Envelope( p_key in number, p_XML in VARCHAR2) is
    lastIndex number;
    begin
    lastIndex := 0;
    insert into Envelope (
    ENVELOPE_KEY,
    XML )
    values (
    lastIndex,
    sys.XMLTYPE.createXML (p_XML));
    end;
    Here's How I call it:
    This parameter gets through(951 Bytes):
    execute TEST_UCCnet_Add_Envelope( -5, '<envelope communicationVersion="2.2"> <messageHeader> <messageIdentifier> <value>RCIR-MSGID-001</value> </messageIdentifier> <userId>steruser</userId> <representingParty> <gln>0034500000000</gln> </representingParty> </messageHeader> <registerCommandOperand> <registryCatalogueItem type="RegistryCatalogueItemType" creationDate="2001-08-02T12:00:00" documentStatus="ORIGINAL"> <registryCatalogueItemState state="REGISTERED"/> <catalogueItemClassification classificationCategoryCode="UDEX.02.0016.0093"/> <catalogueItemReference> <gtin>00061420464322</gtin> <dataSource>1701911838063</dataSource> </catalogueItemReference> <sourceDataPool>8507247615230</sourceDataPool> <informationProviderOfTradeItem> </informationProviderOfTradeItem> </registryCatalogueItem> <test_tag></test_tag> </registerCommandOperand> </envelope>');
    This one, does not (987 Bytes). All I added is the test_tag element:
    execute TEST_UCCnet_Add_Envelope( -6, '<envelope communicationVersion="2.2"> <messageHeader> <messageIdentifier> <value>RCIR-MSGID-001</value> </messageIdentifier> <userId>steruser</userId> <representingParty> <gln>0034500000000</gln> </representingParty> </messageHeader> <registerCommandOperand> <registryCatalogueItem type="RegistryCatalogueItemType" creationDate="2001-08-02T12:00:00" documentStatus="ORIGINAL"> <registryCatalogueItemState state="REGISTERED"/> <catalogueItemClassification classificationCategoryCode="UDEX.02.0016.0093"/> <catalogueItemReference> <gtin>00061420464322</gtin> <dataSource>1701911838063</dataSource> </catalogueItemReference> <sourceDataPool>8507247615230</sourceDataPool> <informationProviderOfTradeItem> <test_tag>kkkkkkkkkkkkkkk</test_tag> </informationProviderOfTradeItem> </registryCatalogueItem> <test_tag></test_tag> </registerCommandOperand> </envelope>');
    And here's the error message:
    ERROR:
    ORA-01756: quoted string not properly terminated
    SP2-0042: unknown command "pe>')" - rest of line ignored.
    This suggests strongly that the argument is simply too long for the SP to accept. Am I right?
    Thanks,
    Peter

  • Oracle Payments - Funds Capture - Create Settlement Batches - Customize Standard XML extract

    Hi,
    I am required to customize the output produced by 'Create Settlement Batches' program.
    There are two parts to it:
         1. Customizing Standard XML
              This is required to add custom XML Tags to the standard XML extract.
              I read in a meta-link note that this can be achieved through table iby_trxn_extensibility. Oracle suggests that we insert rows into this table via a trigger on iby_trxn_summaries_all, and           these rows will appear as additional XML Tags in the Standard XML extract.
              I need to figure out how to populate the column iby_trxn_extensibility.extend_name so that the new XML Tag appears at a specific path in the Standard XML extract.
              Kindly provide your valuable inputs on this?
         2. Customizing Standard RTF
              In case of Funds Disbursement, we have a standard Format called 'US NACHA Generic Format'. Do we have a similar seeded Format in case of Funds Capture?
    Best Regards,
    Uday Arora

    I am wondering whether u were able to achieve this. I am able to insert via autonomous transaction but it insert duplicate values, HOW to avoid duplicate.

  • Xml extract assign to varchar2

    How do i assign the xml Extract to a varchar2.. its throwing me error, is it possible or an alternative method to do this.
    ST_Name1 varchar2(120);
    ST_Name1:= xml_st.EXTRACT ('ST/Name1/text()').getstringval ();Thanks

    its throwing me errorit would also help to mention what kind of error you get!
    In general it would work:
    SQL> declare
       ST_Name1 varchar2 (120);
       xml_st   xmltype := xmltype ('<ST><Name1>SomeName</Name1></ST>');
    begin
       ST_Name1 := xml_st.extract ('ST/Name1/text()').getstringval ();
       dbms_output.put_line(ST_Name1);
    end;
    SomeName
    PL/SQL procedure successfully completed.

  • Xml extract - a particular value (not the whole tag

    Hi
    I have an xml in database column as follows:
    <tag1 xmlsn:ns1="http://abc.def.org/".....>
    <ns1:tag2>...</ns1:tag2>
    <ns1:xyz
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="virtual">
    <ns1:abcdesc xsi:type="xType">
    <ns1:abcdesc xsi:type="defDesc">
    <ns1:abcdesc xsi:type="yType">
    <ns1:Name>ABC</ns1:Name>
    <ns1:id>171351</ns1:id>
    </ns1:abcdesc>
    </ns1:abcdesc>
    <ns1:abcdesc xsi:type="defDesc">
    <ns1:abcdesc xsi:type="yType">
    <ns1:Name>ABC</ns1:Name>
    <ns1:id>171352</ns1:id>
    </ns1:abcdesc>
    </ns1:abcdesc>
    </ns1:abcdesc>
    </ns1:xyz>
    </tag1>
    How may I extract only the id's given?
    This is my query:
    select
    tablename.xmlcolumn.extract('//tag1/ns1:xyz/ns1:abcdesc/ns1:id','xmlns:ns1="http://abc.def.org/"').getSDtringVal()
    from tablename
    I do not get just the id's with this query but the whole xml tag as follows:
    <ns1:id xmlns:ns1="http://abc.def.org/">171351</ns1:id>
    Any help?
    Thx!

    Got it.
    Adding text() after the id in the query helps.
    Thx!

  • Xml extract problem

    I have a problem about sql to extract xml node,the sql followed:
    select a.disptx.extract('/Record/_20/text()').getStringVal() from swifti a where swidty = '6666666666666666666'
    and the clob is :
    <Record>
    <swrctm>2223</swrctm>
    <swintm>22:23:13</swintm>
    <swindt>20100826</swindt>
    <fmbank>ssssss</fmbank>
    <tobank>444444rrrrrrr</tobank>
    <fm>sdfds</fm>
    <to>wwwwwwwwww</to>
    <mgtype>103</mgtype>
    <swftid>dddddd</swftid>
    <sw108f>dddddd</sw108f>
    <swackf>0</swackf>
    <_20>fffffffffff</_20>
    </Record>
    that throw the exception:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00601: Invalid token in: '/Record/_20/text()'
    ORA-06512: at "SYS.XMLTYPE", line 111
    31011. 00000 - "XML parsing failed"
    *Cause:    XML parser returned an error while trying to parse the document.
    *Action:   Check if the document to be parsed is valid.
    can help me?

    you need convert clob to xmltype
    select xmltype(a.disptx).extract('/Record/_20/text()').getStringVal() from swifti a
    create table test (x clob);
    Table created.
    insert into test values ('<Record>
    <swrctm>2223</swrctm>
    <swintm>22:23:13</swintm>
    <swindt>20100826</swindt>
    <fmbank>ssssss</fmbank>
    <tobank>444444rrrrrrr</tobank>
    <fm>sdfds</fm>
    <to>wwwwwwwwww</to>
    <mgtype>103</mgtype>
    <swftid>dddddd</swftid>
    <sw108f>dddddd</sw108f>
    <swackf>0</swackf>
    <_20>fffffffffff</_20>
    </Record>');
    commit;
    1 row created.
    Commit complete.
    SELECT xmltype(x).EXTRACT ('/Record/_20/text()').getstringval ()
      FROM test;
    XMLTYPE(X).EXTRACT('/RECORD/_20/TEXT()').GETSTRINGVAL()                        
    fffffffffff                                                                    
    1 row selected.http://docs.oracle.com/cd/B10500_01/appdev.920/a96620/xdb04cre.htm

  • Need Xml Extraction help...not very urgent but only 6 Hrs left...

    Hi,
         I have an xml in a blob column and I need to extract the xml resultset into the (specified below) row/column format. So that i created a custom blob_to_clob function for this conversion and extracted below specified xml. Now I am executing the below specified queries for this xml to extract PanelSet, PanelId, Link values & attributes. but the problem is, I am not been able to relate the parent and child nodes or may be not able to identify, who belongs to who (parent--child). for e.g if I extract all link i.e status1, status2 etc of a particular Panel then i am not been able to access its (parent) Panel identification.please suggest me any solution.
    --query using
    --to extract PanelSet
    select
      extractValue(value(t),'/PanelSet/@name') panelset_name
      from
        (Select blob_to_clob(grp_menu) blobval
        from OUG
        WHERE user_group_seqno =9) c,
    table(xmlsequence(extract(xmltype.createxml(c.blobval),'/Menus/PanelSet'))) t
    --to extract PanelID
    select
      extractValue(value(t),'/PanelID/text()') panelid
      from
        (Select blob_to_clob(grp_menu) blobval
        from oug
        WHERE user_group_seqno =9) c,
    table(xmlsequence(extract(xmltype.createxml(c.blobval),'/Menus/PanelSet/PanelID'))) t
    --to extract Panel
    select
      extractValue(value(t),'/Panel/@id') Panel_id,
      extractValue(value(t),'/Panel/@name') Panelname
      from
        (Select blob_to_clob(grp_menu) blobval
        from oug
        WHERE user_group_seqno =9) c,
    table(xmlsequence(extract(xmltype.createxml(c.blobval),'/Menus/Panel'))) t
    --to extract link
    select
      extractValue(value(t),'/Link/@name') link_name,
      extractValue(value(t),'/Link/@type') link_type,
      extractValue(value(t),'/Link/text()') link_value 
      from
        (Select blob_to_clob(grp_menu) blobval
        from oug
        WHERE user_group_seqno =9) c,
    table(xmlsequence(extract(xmltype.createxml(c.blobval),'/Menus/Panel/Link'))) t
    --XML
    <Menus>
        <PanelSet name="0_Data center_A">
        <PanelID>1-1</PanelID>
        <PanelID>1-2</PanelID>
        <PanelID>1-3</PanelID>
        <PanelID>0-0</PanelID>
        <PanelID>1-6</PanelID>
        <PanelID>1-7</PanelID>
    </PanelSet>
       <PanelSet name="1_Data center_B">
          <PanelID>2-4</PanelID>
          <PanelID>2-5</PanelID>
          <PanelID>2-6</PanelID>
          <PanelID>0-0</PanelID>
          <PanelID>2-7</PanelID>
          <PanelID>2-8</PanelID>
    </PanelSet>
       <PanelSet name="2_Data center_C">
          <PanelID>3-2</PanelID>
          <PanelID>3-4</PanelID>
          <PanelID>0-0</PanelID>
          <PanelID>3-9</PanelID>
          <PanelID>3-10</PanelID>
          <PanelID>3-11</PanelID>
    </PanelSet>
          <Panel id="1-1" name="Sts">
            <Link name="status 1" type="Module">forbidden</Link>
            <Link name="status 2" type="Module">/forbidden</Link>
            <Link name="status 3" type="Module">/forbidden</Link>
            <Link name="status 4" type="Module">/forbidden</Link>
            <Link name="status 5" type="Module">/forbidden</Link>
          </Panel>
          <Panel id="1-2" name="Adm">
             <Link name="View 1" type="Module">forbidden</Link>
             <Link name="View 2" type="Module">forbidden</Link>
             <Link name="View 3" type="Module">forbidden</Link>
             <Link name="View 4" type="Module">forbidden</Link>
             <Link name="View 5" type="Module">forbidden</Link>
             <Link name="View 6" type="Module">forbidden</Link>
             <Link name="View 7" type="Module">forbidden</Link>
          </Panel>
          <Panel id="2-4" name="Position">
             <Link name="viewer 1" type="Module">forbidden</Link>
             <Link name="viewer 2" type="Module">forbidden</Link>
          </Panel>
          <Panel id="3-2" name="Administration">
             <Link name="inquiry 1" type="Module">forbidden</Link>
          </Panel>
          <Panel id="3-4" name="Reconciliation">
            <Link name="reconciliation 1" type="Module">forbidden</Link>
            <Link name="reconciliation 2" type="Module">forbidden</Link>
            <Link name="reconciliation 3" type="Module">forbidden</Link>
          </Panel> 
    </Menus>
    --Structure
                                       -----Link abc
                                      -     Link abd
                                  -      Link abe
                -----Panel ID 1-1-                
                  -     Panel ID 1-2--------link a--z (more than one)
    --------    -      Panel ID 1-3--------link N...
    |PanelSet 0|-
                  ------PanelID 2-1--------link N...
               -     PanelID 2-2--------link N...
    --------     -      PanelID 2-3--------link N...
    |PanelSet 1|-      
                  ------PanelID 3-1--------link N...
    --------     -      PanelID 3-2--------link N...
    |PanelSet 2|-       PanelID 3-1--------link N...
    --resultset required
    Panel_set         Panel_id          link
    0_Data center_A    1-1               Status1
    0_Data center_A    1-1               Status2
    0_Data center_A    1-1               Status3
    0_Data center_A    1-1               Status4
    0_Data center_A    1-1               Status5
    0_Data center_A    1-2               View 1
    0_Data center_A    1-2               View 2
    0_Data center_A    1-2               View 3
    0_Data center_A    1-2               View 4
    0_Data center_A    1-2               View 1
    1_Data center_B    2-4              viewer 1
    1_Data center_B    2-4              viewer 2Message was edited by:
    Sachin.Singh

    with t as
    (select xmltype(
    '... your xml here ...
    ') as xml from dual),
    panel_sets as ( select extractvalue(t2.column_value, '//*/@name') as panel_set,
                           extractvalue(t3.column_value, '//*'      ) as panel_id
                      from t, table(xmlsequence(extract(t.xml,           '//Menus/PanelSet'))) t2,
                              table(xmlsequence(extract(t2.column_value, '//*/PanelID'     ))) t3
        panels as ( select extractvalue(t2.column_value, '//*/@id'  ) as panel_id,
                           extractvalue(t3.column_value, '//*/@name') as link
                      from t, table(xmlsequence(extract(t.xml,           '//Menus/Panel'))) t2,
                              table(xmlsequence(extract(t2.column_value, '//*/Link'     ))) t3
    select s.panel_set, s.panel_id, p.link
      from panel_sets s, panels p
      where p.panel_id = s.panel_id
    PANEL_SET            PANEL_ID LINK
    0_Data center_A      1-1      status 1
    0_Data center_A      1-1      status 2
    0_Data center_A      1-1      status 3
    0_Data center_A      1-1      status 4
    0_Data center_A      1-1      status 5
    0_Data center_A      1-2      View 1
    0_Data center_A      1-2      View 2
    0_Data center_A      1-2      View 3
    0_Data center_A      1-2      View 4
    0_Data center_A      1-2      View 5
    0_Data center_A      1-2      View 6
    0_Data center_A      1-2      View 7
    1_Data center_B      2-4      viewer 1
    1_Data center_B      2-4      viewer 2
    2_Data center_C      3-2      inquiry 1
    2_Data center_C      3-4      reconciliation 1
    2_Data center_C      3-4      reconciliation 2
    2_Data center_C      3-4      reconciliation 3
    18 rows selected.

  • Urgent!! Urgent!! Slow in XML extraction.

    Hi,
    I am using 8.1.7 dB. I have prob in performance, while extractging. I have XML doc like the following.
    - <rowOfCells>
    - <cellValueList>
    <cellValue>Class I Senior Notes</cellValue>
    <cellValue>0</cellValue>
    <cellValue>0.0054</cellValue>
    <cellValue>48164975</cellValue>
    <cellValue>4.18</cellValue>
    <cellValue>304557600</cellValue>
    <cellValue>181835025</cellValue>
    </cellValueList>
    </rowOfCells>
    - <rowOfCells>
    - <cellValueList>
    <cellValue>Class I Senior Notes</cellValue>
    <cellValue>0</cellValue>
    <cellValue>0.0054</cellValue>
    <cellValue>49105975</cellValue>
    <cellValue>4.33</cellValue>
    <cellValue>307906256</cellValue>
    <cellValue>180894025</cellValue>
    </cellValueList>
    </rowOfCells>
    Please noet that the number of "cellValue" tags may vary. I am using the code like the following to extract and make it as a record.
    l_row_node_list := xslProcessor.selectNodes (p_node,'/rowOfCells/cellValueList' );
    FOR i IN 0 .. XMLDOM.getLength (l_row_node_list) - 1
    LOOP
    l_row_node := XMLDOM.item (l_row_node_list, i);
    l_col_node_list := xslProcessor.selectNodes (l_row_node,'cellValue' );
         FOR j IN 0 .. XMLDOM.getLength (l_col_node_list) - 1
    LOOP
         l_grandChildArray(j+1) := SUBSTR(XMLDOM.getNodeValue( XMLDOM.getFirstChild(XMLDOM.item (l_col_node_list, j) ) ),1,100);
         END LOOP;
    -- Make as record structure.
    l_generic_rec.col1 := l_grandChildArray(1);
         l_generic_rec.col2 := l_grandChildArray(2);
         l_generic_rec.col3 := l_grandChildArray(3);
         l_generic_rec.col4 := l_grandChildArray(4);
    l_generic_rec.col5 := l_grandChildArray(5);
         l_generic_rec.col6 := l_grandChildArray(6);
         l_generic_rec.col7 := l_grandChildArray(7);
         l_generic_rec.col8 := l_grandChildArray(8);
    END LOOP;
    This works fine for me, but it takes 5 minutes to extract for 1200 cellValueList. I want to speed up this process.Is there any way i can modify this code or use some other way to speed up the process of extraction?
    Advanced Thanks
    Ramesh

    Your code using the DOM APIs looks fine. You can change 'cellValue' to '/cellValue' and see if there will be any improvement:
    l_col_node_list := xslProcessor.selectNodes (l_row_node,'/cellValue' );
    Or you can use the SAX streaming method to get the data. Would you like to send the sample data?

  • XML Extract function help

    I have below xml in oracle table, how to extract partial address data "10 Otterburn Gardens, ISLEWORTH, Middlesex TW4 5JJ" using sql
    <?xml version="1.0"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
        <qas:QASearchResult xmlns:qas="http://www.qas.com/web-2009-08" VerifyLevel="None">
          <qas:QAPicklist AutoFormatSafe="true">
            <qas:FullPicklistMoniker>0_MGBRFQbdBwAAAAABAQEAAQAAAADfKULSACEYAgAAAAAAMTYAAP..ZAAAAAD.....AAAAAAAAAAA-</qas:FullPicklistMoniker>
            <qas:PicklistEntry FullAddress="true">
              <qas:Moniker>0XOGBRFQbdBwAAAAABAwEAAAAA3ylC0gAhGAIAAAAAADE2AAD..2QAAAAA.....wAAAAAAAAAAADE2IE90dGVyYnVybiBHYXJkZW5zLCBUVzcgNUpKAA--</qas:Moniker>
              <qas:PartialAddress>10 Otterburn Gardens, ISLEWORTH, Middlesex TW4 5JJ</qas:PartialAddress>
              <qas:Picklist>16 Otterburn Gardens, ISLEWORTH, Middlesex</qas:Picklist>
              <qas:Postcode>TW7 5JJ</qas:Postcode>
              <qas:Score>100</qas:Score>
            </qas:PicklistEntry>
            <qas:Prompt>Enter selection</qas:Prompt>
            <qas:Total>1</qas:Total>
          </qas:QAPicklist>
        </qas:QASearchResult>
      </soap:Body>
    </soap:Envelope>

    Also, I can see here -- ORA-19279: XPTY0004 - XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence
    that you have used another technique XMLNamespaces() for the same.
    select x.*
    from abc t
       , xmltable(
           xmlnamespaces(
             default 'urn:swift:xsd:fin.970.2011'
           , 'urn:swift:xsd:mtmsg.2011' as "ns0"
         , '/ns0:FinMessage/ns0:Block4/Document/MT970/F61a/F61'
           passing t.col1
           columns F61ValueDate                Varchar(40) Path 'ValueDate'
                 , DebitCreditMark             Varchar(40) Path 'DebitCreditMark'
                 , Amount                      Varchar(40) Path 'Amount'
                 , TransactionType             Varchar(40) Path 'TransactionType'
                 , IdentificationCode          Varchar(40) Path 'IdentificationCode'                 
                 , ReferenceForTheAccountOwner Varchar(40) Path 'ReferenceForTheAccountOwner'
                 , SupplementaryDetails        Varchar(40) Path 'SupplementaryDetails'       
         ) x;
    What you are trying to do here? and why that "default" namespace?
    Also, I'll also go through the docs in this meantime.
    -- Ranit

  • XML Extract from CLOB Column

    We have some XML data loaded into CLOB columns, for reasons too long to explain here we are not using the XMLTYPE, but we do need to extract rows based on conditions of the XML data. For performance reasons we do not want to index the CLOB column. I am looking at ways of inspecting the XML and returning matching results by casting the CLOB out as XMLTYPE and opening up xpath/xquery functions - but need this to be efficient. I have initially used extract().getXXXXVal in the where clause of a select statement, ie. where x.xmltype(clob_col).extract('<xpath>').getNumberVal = nn, but have found this very inefficient with memory usage increasing consistently and CPU hitting 100%. can anyone suggest some alternative methods?

    Hi
    In expression operator ignore "PLS-00201: identifier 'EXTRACTVALUE' must be declared" .
    In Mapping Level Configure Default Operating Mode : Setbased and
    Generation Mode : Setbased
    and deploy and execute your mapping.

  • SOS! a tough XML extract issue.

    i have a xmltype table like this:
    SQL> select object_value from tbl_testxml;
    <members>
    <grandfather name="Tom" age="66">
    <father name="John" age="46">
    <son name="Simon" age="20"/>
    <son name="Steve" age="19"/>
    </father>
    <father name="Jeff" age="45">
    <son name="Mark" age="17"/>
    <son name="Mathiew" age="15"/>
    </father>
    </grandfather>
    </members>
    What i want to do is extract the grandfather, father and son's name (in the same line if they are in same family), so i use this sql query:
    select extract(value(v_xml),'//grandfather/@name') as grandfather,
    extract(value(v_xml),'//grandfather/father/@name') as father,
    extract(value(v_xml),'//grandfather/father/son/@name') as son
    from tbl_testxml t,
    TABLE (XMLSEQUENCE (EXTRACT (t.object_value, '/members'))) v_xml;
    The output is like this eventually:
    grandfather                              father                                  son
    ========                                 ==============                          ================
    Tom                                       JohnJeff                               SimonSteveMarkMathiewBut this is not what i want, what i want is like this:
    grandfather          father         son
    ========             ======         ======
    Tom                   John           Simon
    Tom                   John           Steve
    Tom                   Jeff            Mark
    Tom                   Jeff            Mathiewis that possible to get the result as above?
    i've tried xmlquery, xmltable etc, none of them works :(
    Thanks so much!
    Edited by: user3318788 on Jul 10, 2009 5:14 PM
    Edited by: user3318788 on Jul 11, 2009 5:23 PM
    Edited by: user3318788 on Jul 11, 2009 5:29 PM

    Certainly not the ideal solution, but you could transform the original XML using XSL so that it better fits your requirement :
    SELECT extractvalue(v_xml.column_value,'//grandfather') as grandfather,
           extractvalue(v_xml.column_value,'//father') as father,
           extractvalue(v_xml.column_value,'//son') as son
    FROM tbl_testxml t,
    TABLE(
    XMLSEQUENCE(
      EXTRACT(t.object_value.transform(
              xmltype('<?xml version="1.0"?>
              <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
              <xsl:template match="/">
              <all_branches>
               <xsl:for-each select="//son">
                <branch>
                 <grandfather><xsl:value-of select="../../@name"/></grandfather>
                 <father><xsl:value-of select="../@name"/></father>
                 <son><xsl:value-of select="@name"/></son>
                </branch>
               </xsl:for-each>
              </all_branches>
              </xsl:template>
              </xsl:stylesheet>')
              ), '//branch'
    ) v_xml;Basically, the XSL takes each leaf (ie each son), retrieves its ancestors and presents them all in distinct BRANCH element.
    The SQL query then just extracts all BRANCH nodes with XMLSEQUENCE (XMLTABLE works as well) and extracts again each member in separate column.

  • Error with XML extraction.

    Hello experts,
    Activated the XML service and connected the MS reporting designer to pull meta data from the BI development server and all worked good. However, it is throwing an error in QA system as 'E RSDSDSO 201 Cannot be processed in plugin mode HTTP (XML for Analysis Provider)'.  Activated the trace and couldn't find any useful info. No dumps in ST22.  I tested the URL through internet explorer and it works fine.
    Has anybody faced this problem and any clue/help is very much appreciated.   Points are sure.
    Thanks
    Viswa

    You may post your quesiton on JDeveloper Forum

  • Extract parent and child data from an XML sequence?

    I'm very new to XML, so please excuse me if I use incorrect terminology here. I've been given a schema definition (.xsd), and several sample xml files from which I need to extract data and insert it into relational tables. I've made some progress in that I've been able to hack enough to modify and register the schema and get the XML into the database both through the registered schema and into a separate table with an XMLType column. I've also been able to use the isSchemaValid function to validate the XML against the schema definition, and I've been able to extract some of the simple data elements via the extractValue function. My problem is with extracting some of the nested data - that is, extracting parent node elements and child node elements together where there is more than one value in the child node. BTW. I'm on Oracle 10gR2.
    Following are the .xsd and and sample XML. Specifically, I need to select the NPI value from the PROVIDER node, and associate it with each of the CODE values from the SPECIALTIES node (which is part of the PROVIDER node).
    Here's the .xsd (sorry, it's very long). The only modifications I've made to the schema definition are to add the xdb namespace and the "xdb:defaultTable="HMOSCHEMA" snippet:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0">
    <xsd:element name="HMO" xdb:defaultTable="HMOSCHEMA">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="HMO_GENERAL_INFORMATION" />
    <xsd:element ref="PROVIDERS" />
    <xsd:element ref="FACILITIES" minOccurs="0"
    maxOccurs="1" />
    </xsd:sequence>
    <xsd:attribute name="DATE" type="xsd:string" />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="HMO_GENERAL_INFORMATION">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="MCO_ID_LIST" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="HMO_WEBSITE_ADDRESS" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="HMO_SPECIAL_SERVICES" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="HMO_DAILY_CONTACT_EMAIL_ADDRESS"
    minOccurs="1" maxOccurs="1" />
    <xsd:element ref="HMO_MONTHLY_CONTACT_EMAIL_ADDRESS"
    minOccurs="1" maxOccurs="1" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="PROVIDERS">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" ref="PROVIDER" />
    </xsd:sequence>
    <xsd:attribute name="RECORDS" type="xsd:string" />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="PROVIDER">
    <xsd:complexType>
    <xsd:sequence minOccurs="1" maxOccurs="unbounded">
    <xsd:element ref="NPI" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="FIRST_NAME" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="LAST_NAME" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="MIDDLE_INITIAL" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="GENDER" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="LINE_1_ADDRESS" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="LINE_2_ADDRESS" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="CITY" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="STATE" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="ZIP" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="COUNTY" minOccurs="0" maxOccurs="1" />
    <xsd:element ref="PHONE_NUMBER" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="CLINIC_NAME" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="CLINIC_TYPE" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="CLINIC_NPI" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="PROVIDER_OFFICE_HOURS_TENTHS"
    minOccurs="0" maxOccurs="1" />
    <xsd:element ref="MAXIMUM_PATIENTS" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="ACCEPT_NEW_PATIENT" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="PRIMARY_CARE_INDICATOR" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="FOREIGN_LANGUAGES" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="SPECIALTIES" minOccurs="1"
    maxOccurs="1" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="SPECIALTIES">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" name="CODE"
    minOccurs="1">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{3}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="FACILITIES">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" ref="FACILITY_NUM"
    minOccurs="0" />
    </xsd:sequence>
    <xsd:attribute name="RECORDS" type="xsd:string" />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="FOREIGN_LANGUAGES">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" name="CODE"
    minOccurs="0">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[A-Z]{3}" />
    <xsd:pattern value="[a-z]{3}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="HMO_SPECIAL_SERVICES">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" name="CODE"
    minOccurs="0">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="MCO_ID_LIST">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="MCO_ID" minOccurs="1" maxOccurs="unbounded">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{6}" />
    <xsd:pattern value="[0-9]{7}" />
    <xsd:pattern value="[0-9]{8}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="HMO_WEBSITE_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:maxLength value="100" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="HMO_DAILY_CONTACT_EMAIL_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:maxLength value="50" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="HMO_MONTHLY_CONTACT_EMAIL_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:maxLength value="50" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="NPI">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{6}" />
    <xsd:pattern value="[0-9]{7}" />
    <xsd:pattern value="[0-9]{8}" />
    <xsd:pattern value="[0-9]{9}" />
    <xsd:pattern value="[0-9]{10}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="FIRST_NAME">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="LAST_NAME">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="MIDDLE_INITIAL">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:maxLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="GENDER">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:maxLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="LINE_1_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="LINE_2_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="CITY">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="STATE">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[a-zA-Z][a-zA-Z]" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="ZIP">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{9}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="COUNTY">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="PHONE_NUMBER">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{10}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="CLINIC_NAME">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="CLINIC_TYPE">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="CLINIC_NPI">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{6}" />
    <xsd:pattern value="[0-9]{7}" />
    <xsd:pattern value="[0-9]{8}" />
    <xsd:pattern value="[0-9]{9}" />
    <xsd:pattern value="[0-9]{10}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="PROVIDER_OFFICE_HOURS_TENTHS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="MAXIMUM_PATIENTS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="ACCEPT_NEW_PATIENT">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[A-Z]{1}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="PRIMARY_CARE_INDICATOR">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[A-Z]{1}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="FACILITY_NUM">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{6}" />
    <xsd:pattern value="[0-9]{7}" />
    <xsd:pattern value="[0-9]{8}" />
    <xsd:pattern value="[0-9]{9}" />
    <xsd:pattern value="[0-9]{10}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:schema>
    Here's a sample of the XML (significantly shortened, and names and IDs changed to protect the innocent). BTW, the XML validates cleanly against the schema definition:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <HMO DATE="03/26/2010">
    <HMO_GENERAL_INFORMATION>
    <MCO_ID_LIST>
    <MCO_ID>11111111</MCO_ID>
    </MCO_ID_LIST>
    <HMO_WEBSITE_ADDRESS>HTTP://WWW.SOMEHMONAME.COM</HMO_WEBSITE_ADDRESS>
    <HMO_SPECIAL_SERVICES>
    <CODE>00</CODE>
    </HMO_SPECIAL_SERVICES>
    <HMO_DAILY_CONTACT_EMAIL_ADDRESS>somename@someurl</HMO_DAILY_CONTACT_EMAIL_ADDRESS>
    <HMO_MONTHLY_CONTACT_EMAIL_ADDRESS>somename@someurl</HMO_MONTHLY_CONTACT_EMAIL_ADDRESS>
    </HMO_GENERAL_INFORMATION>
    <PROVIDERS RECORDS="1011">
    <PROVIDER>
    <NPI>1111111111</NPI>
    <FIRST_NAME>JOHN</FIRST_NAME>
    <LAST_NAME>DOE</LAST_NAME>
    <MIDDLE_INITIAL>A</MIDDLE_INITIAL>
    <GENDER>M</GENDER>
    <LINE_1_ADDRESS>1111 Some Rd</LINE_1_ADDRESS>
    <LINE_2_ADDRESS> </LINE_2_ADDRESS>
    <CITY>NOWHERE</CITY>
    <STATE>YN</STATE>
    <ZIP>12345</ZIP>
    <COUNTY>13</COUNTY>
    <PHONE_NUMBER>1111111111</PHONE_NUMBER>
    <CLINIC_NAME>SOME CLINIC - CORPORATE OFFICE</CLINIC_NAME>
    <CLINIC_NPI/>
    <ACCEPT_NEW_PATIENT>Y</ACCEPT_NEW_PATIENT>
    <PRIMARY_CARE_INDICATOR>N</PRIMARY_CARE_INDICATOR>
    <FOREIGN_LANGUAGES>
    <CODE> </CODE>
    </FOREIGN_LANGUAGES>
    <SPECIALTIES>
    <CODE>170</CODE>
    </SPECIALTIES>
    </PROVIDER>
    <PROVIDER>
    <NPI>2222222222</NPI>
    <FIRST_NAME>JANE</FIRST_NAME>
    <LAST_NAME>DOE</LAST_NAME>
    <MIDDLE_INITIAL>J</MIDDLE_INITIAL>
    <GENDER>F</GENDER>
    <LINE_1_ADDRESS>2222 SOMEOTHER ST</LINE_1_ADDRESS>
    <LINE_2_ADDRESS> </LINE_2_ADDRESS>
    <CITY>MYTOWN</CITY>
    <STATE>YN</STATE>
    <ZIP>12345</ZIP>
    <COUNTY>13</COUNTY>
    <PHONE_NUMBER>2222222222</PHONE_NUMBER>
    <CLINIC_NAME>SOME CLINIC - MYTOWN</CLINIC_NAME>
    <CLINIC_NPI/>
    <ACCEPT_NEW_PATIENT>Y</ACCEPT_NEW_PATIENT>
    <PRIMARY_CARE_INDICATOR>N</PRIMARY_CARE_INDICATOR>
    <FOREIGN_LANGUAGES>
    <CODE> </CODE>
    </FOREIGN_LANGUAGES>
    <SPECIALTIES>
    <CODE>322</CODE>
    <CODE>329</CODE>
    </SPECIALTIES>
    </PROVIDER>
    </PROVIDERS>
    <FACILITIES RECORDS="2">
    <FACILITY_NUM>1000000001</FACILITY_NUM>
    <FACILITY_NUM>2000000002</FACILITY_NUM>
    </FACILITIES>
    </HMO>
    As you can see, the SPECIALTIES node can contain more than one CODE value, si I can't use extractValue to retrieve them. Again, I need to extract the NPI value from the PROVIIDER node, and associate it with each of the CODE values from the SPECIALTIES node. So, what I would need to extract from this sample XML would be:
    NPI CODE
    1111111111 170
    2222222222 322
    2222222222 329
    This seems like it should be a pretty routine requirement, but I've tried everything I can think of (that is, everything I've learned to this point), and have not yet found a way............
    Ideally, the solution to extracting this data would utilize SQL (not PL/SQL, or Java, or XSL, etc) with XML extraction functions (e.g. extract, extractValue, XMLSequence, XMLTable, etc).
    Can anyone provide me with an example of how that iterative specialy code data could be extracted? Do I need to modify the .xsd to facilitate this extraction (so that registration of the schema results in other objects in the database)?
    Any suggestions or examples would be greatly appreciated.
    Thanks in advance, Dan
    P.S. - I hope the XML displays OK when I post this question!

    Hi,
    Thanks for your detailed sample, it's very helpful.
    This seems like it should be a pretty routine requirementIndeed, that's a classic (once you've got the method).
    So, here's how you can do it :
    SELECT x1.npi, x2.code
    FROM t,
         XMLTable(
          '/HMO/PROVIDERS/PROVIDER'
          passing t.doc
          columns
            npi number path 'NPI',
            specialties xmltype path 'SPECIALTIES'
         ) x1,
         XMLTable(
          'SPECIALTIES/CODE'
          passing x1.specialties
          columns
            code number path '.'
         ) x2
    ;Assuming the XML is stored in column T.DOC.
    As you see, for each NPI, the trick is to pass the entire SPECIALTIES node (kind of a join) to another nested XMLTable so that each CODE could be extracted as well.
    There's another method using only one XMLTable and a little more complex XQuery. I'll try to post it soon.
    HTH.
    Edit : 2nd method
    SELECT x.*
    FROM t,
         XMLTable(
          'for $i in /HMO/PROVIDERS/PROVIDER/SPECIALTIES/CODE
           return element e
            attribute npi { $i/../../NPI },
            $i/text()
          passing t.doc
          columns
            npi  number path '@npi',
            code number path '.'
         ) x
    ;Edited by: odie_63 on 27 mai 2010 18:43

Maybe you are looking for

  • ABAP API to store DATE value in MDM 5.5

    Hello All, Currently I am working on MDM 5.5 and need to have some suggestions on ABAP API Function module to store date values in MDM. We have interface from where we take the user input which updates the field value back in the MDM. On the basis of

  • Wicd connects to Wired fine but is unable to connect to wireless

    I don't think I have changed anything, but now wicd will not connect to any wireless network (Stuck at optaining IP address, or Verifying association if I use static ip, and then, without saying a specific error, quits connecting and goes back to not

  • Error: ERR-1002 Unable to find item ID for item "APP_SESSION"

    Hello all, I created an application for faculty in HTMLDB 1.6. To get to the application faculty members log into a different website, and then follow a link to my application. The link re-directs them to a public page which pulls their unique ID fro

  • Payment and account enquire

    Hi All , I have 3 pending $6.49 payments coming out of my account  - they say they are still 'pending', i would like to cancel them all.  i also have one processed payment of $6.49 that has gone thru my itunes account, and i still cannot see the cred

  • ABAP query output not showing all output fields

    I added a new field group in an existing query and marked them to display in the output list. When I test the output from SQ01 -> InfoSer Query, the output is what I expect. However, if I execute the query itself, it does not show the additional fiel