Extract the value of an xml file-

Hello
I have a requirement that needs to store the contents of the XML db tables. Here I give you the details of the sample, it must extract values from the XML file and place these values in the mapping table.

Sample:

I created a table - create the table txt_xml of xmltype.

insert into table txt_xml values (xmltype ('))
< NewDataSet >
"" < DerivativeSecurity FAS157Level = "3" FAS157MVAdjustable = "N" OriginalMV = FAS157MVDelta "573174.3253" = "0.0" FAS157AdjustedMV = "573174.3253" PLCurrency = "USD" DerivativeSecurityID = "2009-BFWD-0001TRD' MetDerivativeID = '2009-BFWD-0001' MurexTransactionNumber = '36319' Trader '_GTELL' BuySell = =" B "DetailType = 'TRD' DerivativeType = 'BFWD' AL_ManagementSide = 'Active' CounterpartyCode = '3045' CounterpartyName =" ' JPM / CHASE "CurrencyCode ="USD"Coupon ="0,0"FixedFloatingIndicator ="FIXRT"IndexMultiplier ="1.0"IndexName = 'Bond' ="0,0"Comment11 = margin" PCG 6.05 01 / 03 / 34 "Comment12 ="2009-BFWD-0001"Comment13 ="694308GE1"Comment21 =" "Comment22 = Comment23"83003169"="1 618 300"TradeComment =" are created-credit of the assets for the current article "" specific - anticipation Hedge - PCG FWD 6.05% 01/03/2034. Are created. "" "" "" - Original M"OptionCallPut =" "OptionType =" "SettleType = 'Cash' RefISIN =" "RefObligation =" "sensitivity ="15044.6506"EffectiveConvexity ="0,0"Vega ="0,0"NextResetDate =" "LastResetDate =" "EffectiveDuration ="13.9289"Instrument"Bond"IssuerCode ="19039"IssuerName = ="PACIFIC GAS' IssuerREDCode '6FD738' strategy = = "CRD-PROT-07" StrikePrice = MaturityDate '105.89' = "TickerSymbol =" 2010-01-04 "" "MetPay =" "MetRec =" "Payrec =" P "RiskSection =" "HedgedItem =" deadline specific asset "ResetFrequency =" "ResetFrequencyNumber =" "PaymentFrequency =" "PaymentFrequencyNumber =" "CapFloorCoupon ="0.0"RefIndexRate ="0,0">"
< name of classification = "XHSEC" Value = "Derivatives" ValueDescription = "950" / >
< name of classification = "XSEC" ValueDescription = 'Credit' Value = '430' / >
< name of classification = "XLEV1" ValueDescription = value 'Before' = "9400" / >
< name of classification = "XLEV2" ValueDescription = 'Hedge' Value = "150000" / >
< / DerivativeSecurity >
((< / NewDataSet > '));

now what I need is OriginalMV value of this XML field. Please help me

Published by: Govind2 on February 5, 2010 08:33

Yes it will fail because error explains everything... excerpt from value does not return several values for a simple xpath...

so in this case you must use the function xmltable...

 SELECT column_value
   FROM some_things v,
  xmltable('for $i in /NewDataSet/DerivativeSecurity return $i/@FAS157Level' passing value(v))

edit your table name in the code above... and confirm

Ravi Kumar

Tags: Database

Similar Questions

  • Extract the value of an xml file (LPX-00601: invalid token)

    Hello

    I have this kind of XML / example...

    declare
        l_clob clob;
        l_xml xmltype;
    
    
    begin
        l_clob := '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:fu="http://www.fu.gov.si/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <soapenv:Body>
            <fu:BusinessPremiseResponse Id="data">
                <fu:Header>
                    <fu:DateTime>2015-10-02T10:56:40.416Z</fu:DateTime>
                    <fu:MessageID>2107C422-FC85-291C-E053-0CC910AC3C4F</fu:MessageID>
                </fu:Header>
                <fu:Error>
                    <fu:ErrorCode>S001</fu:ErrorCode>
                    <fu:ErrorMessage>eriworwiweorioweriorio</fu:ErrorMessage>
                </fu:Error>
            </fu:BusinessPremiseResponse>
        </soapenv:Body>
    </soapenv:Envelope>
    ';
     l_xml := xmltype(l_clob);
      put_xl_line(l_xml.extract('/soapenv:Envelope/soapenv:Body/fu:BusinessPremiseResponse/fu:Error/fu:ErrorCode/text()','xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"').getStringVal());
    
    end;
    

    what I want is to extract the /soapenv:Envelope / soapenv:Body / fu:BusinessPremiseResponse / fu:Error / fu:ErrorCode

    I get this kind of error:

    ORA-31011: XML parsing failed

    ORA-19202: an error has occurred in the processing of XML

    LPX-00601: token not valid in: ' / soapenv:Envelope / soapenv:Body / fu:BusinessPremiseResponse / fu:Error / fu:ErrorCode / text () '

    ORA-06512: at "SYS." XMLTYPE", line 107

    ORA-06512: at line 23

    Thank you

    Hi Peter,.

    What is your version of db?

    EXTRACT and related functions are all deprecated from 11.2.

    Use XMLTABLE or XMLQUERY.

    About the error:

    You have the XPath to the right, but missing the mapping prefix of "fu":

    (l_xml). Extract

    ' / soapenv:Envelope / soapenv:Body / fu:BusinessPremiseResponse / fu:Error / fu:ErrorCode / text () '

    "', ' xmlns:soapenv ="http://schemas.xmlsoap.org/soap/envelope/"

    xmlns:Fu ="http://www.fu.gov.si/" "."

    )

    Example with XMLTABLE:

    declare
      l_clob        clob;
      l_error_code  varchar2(30);
    begin
      l_clob := '
        
            
                
                    2015-10-02T10:56:40.416Z
                    2107C422-FC85-291C-E053-0CC910AC3C4F
                
                
                    S001
                    eriworwiweorioweriorio
                
            
        
    ';
    
      select errorcode
      into l_error_code
      from xmltable(
             xmlnamespaces(
               'http://schemas.xmlsoap.org/soap/envelope/' as "env"
             , default 'http://www.fu.gov.si/'
             )
           , '/env:Envelope/env:Body/BusinessPremiseResponse/Error'
             passing xmlparse(document l_clob)
             columns errorcode varchar2(30) path 'ErrorCode'
           ) ;
    
      dbms_output.put_line(l_error_code);
    
    end;
    /
    
  • Select the values to an xml file

    i am unable to solve this....
    better solution or any useful steps. to get the required result.
    
    
     select sys, SYSS, accesskey from  xmltable('root/flexcube/contractStatus'         passing xmltype('
        <root>
          <flexcube>
            <confNum>123</confNum> 
              <contractStatus>
                   <system>12-JAN-2012</system>
                   <accessKey>eDealer</accessKey>
              </contractStatus>
              <contractStatus>
                   <system>12-DEC-2011</system>
                   <accessKey>iDealer</accessKey>
              </contractStatus>
              <contractStatus>
                   <system>12-FEB-2012</system>
                   <accessKey>USER</accessKey>
              </contractStatus>
         </flexcube>
      </root>') 
                       columns 
                       SYS VARCHAR2(12) path 'root/flexcube/conf',
                       SYSS VARCHAR2(12) path '//system',
                       accessKey varchar2(10) path '//accessKey');
    
    
    Result:
    
    SYS          SYSS         ACCESSKEY  
    ------------ ------------ ---------- 
               12-JAN-2012  eDealer    
               12-DEC-2011  iDealer    
               12-FEB-2012  USER       
    
    3 rows selected
    
    
    required result:
    
    SYS          SYSS         ACCESSKEY  
    ------------ ------------ ---------- 
    123        12-JAN-2012  eDealer    
    123        12-DEC-2011  iDealer    
    123        12-FEB-2012  USER       
    
    3 rows selected

    Try

    Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.3.0
    Connected as apps
    
    SQL>
    SQL> with t as
      2   (select xmltype('
      3        
      4          123
      5            
      6                 12-JAN-2012
      7                 eDealer
      8            
      9            
     10                 12-DEC-2011
     11                 iDealer
     12            
     13            
     14                 12-FEB-2012
     15                 USER
     16            
     17       
     18    ') col
     19      from dual)
     20  --
     21  select b.SYS, c.SYSS, ACCESSKEY
     22    from t,
     23         xmltable('root/flexcube'
     24                  passing t.col
     25                  columns SYS varchar2(100) path 'confNum',
     26                          tmp xmltype path 'contractStatus') b
     27        ,xmltable('contractStatus'
     28                   passing b.tmp
     29                   columns SYSS varchar2(100) path 'system',
     30                           ACCESSKEY  varchar2(100) path 'accessKey') c
    SQL> /
    
    SYS                                                                              SYSS                                                                             ACCESSKEY
    -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --------------------------------------------------------------------------------
    123                                                                              12-JAN-2012                                                                      eDealer
    123                                                                              12-DEC-2011                                                                      iDealer
    123                                                                              12-FEB-2012                                                                      USER
    
    SQL>
    
  • Req SQL syntax. to extract the value XML [CLOB]

    Hello

    I'll have the XML column in my table.

    I have XML value in CLOB data type. I had an experience using extract XML from SQL syntax.

    But I am unable to extract this file. I need to meet tagname value XML who gave example below.

    For example, the name of the Table is A
    Column name is A1

    The value of column given below here.

    <? XML version = "1.0" encoding = "ISO-8859-1? > < tags > < tag > < tagname > {docval} < / tagname > < tagvalue > ESPRefNotice < / tagvalue > < / tag > < tag > < tagname > {: inputvalue} < / tagname > < tagvalue > 3216 < / tagvalue > < / tag > < tag > < tagname > {officename} < / tagname > < tagvalue > ssvofficename < / tagvalue > < / tag > < / tags >

    Kindly help me on this to extract the value 'tagname' or 'tagvalue' according to the above xml data.

    Thank you
    SELECT warehouse_name warehouse,
       warehouse2."Water", warehouse2."Rail"
       FROM warehouses,
       XMLTABLE('/Warehouse'
          PASSING warehouses.warehouse_spec
          COLUMNS
             "Water" varchar2(6) PATH '/Warehouse/WaterAccess',
             "Rail" varchar2(6) PATH '/Warehouse/RailAccess')
          warehouse2;
    

    check this exp in the documentation
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions228.htm#CIHGGHFB

    the warehouse_spec is of type xmltype. So in your case it is clob then you need to add like what I did in the query...
    XmlType ()...

    Hope that explains everything...

    Ravi Kumar

  • How to extract the values of XMLTYPE column,

    SQL > create table temporary global xmtype_tab (xmlfile xmltype);

    SQL > select * from all_directories;

    SYS RESTOREDIR/home / / dbimptask /.

    insert into xmtype_tab values (xmltype (dbms_xslprocessor.read2clob ('RESTOREDIR ','LAS_SETUP.xml ')));

    1 line of creation.

    SQL > select * from xmtype_tab;

    XMLFILE
    --------------------------------------------------------------------------------
    <? XML version = "1.0"? >
    rowset <>
    < ROW >
    < DATA_CAPTURE_ON > 1 < / DATA_CAPTURE_ON >


    How to extract the values inside each tag?


    XML file has the following data...


    rowset <>
    < ROW >
    < DATA_CAPTURE_ON > 1 < / DATA_CAPTURE_ON >
    < > 9600 BAUD_RATE < / BAUD_RATE >
    < ACK_TIMEOUT > 1 < / ACK_TIMEOUT >
    < TUBE_TRAVEL_LIMIT > 4 < / TUBE_TRAVEL_LIMIT >
    < SEND_SID_TIMEOUT > 1 < / SEND_SID_TIMEOUT >
    < INDEX_Q_TIMEOUT > 2 < / INDEX_Q_TIMEOUT >
    < HW_HANDSHAKING > 1 < / HW_HANDSHAKING >
    < / ROW >
    < / LINES > ';

    I use the Oracle 10.2.0.3 version...

    Why does this work?

    You are missing the tag of the ROWSET:

    select extractvalue (xmlfile, '/ROWSET/ROW/BAUD_RATE') baud_rate
      from xmltype_tab
     where existsnode (xmlfile, '/ROWSET/ROW/BAUD_RATE') = 1;
    
  • How to get the value of an xml element attributes

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0

    I'm trying to parse an XML document

    < response >
    < well uwi = "102112900816W400" > < / well >
    < production >
    < PRODUCING_ENTITY >
    < NUMBER YEAR = '2009' >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < NUMBER YEAR = '2010' >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < NUMBER YEAR = '2011' >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < NUMBER YEAR = '2012' >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < / PRODUCING_ENTITY >
    < / production >
    < / well >
    < well uwi = "100092900816U400" > < / well >
    < production >
    < PRODUCING_ENTITY >
    < NUMBER YEAR = "1999" >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < NUMBER YEAR = '2000' >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < NUMBER YEAR = '2001' >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < NUMBER YEAR = "2003" >
    < NUMBER of MONTHS = LAST_DAY '1' = "31" / >
    < NUMBER of MONTHS = LAST_DAY '2' = "28" / >
    < NUMBER of MONTHS = LAST_DAY "3" = "30" / >
    < / YEAR >
    < / PRODUCING_ENTITY >
    < / production >
    < / well >
    < / answer >

    For the purposes of the practice, I have saved this in my table tdw_test_xml_files;

    My goal is to get the /WELL/@uwi and /YEAR/@NUMBER

    UWI YEAR
    ------ ---------------
    102112900816W400 2009
    102112900816W400 2010
    102112900816W400 2011
    102112900816W400 2012
    100092900816U400 1999
    100092900816U400 2000
    100092900816U400 2001
    100092900816U400 2003


    I tried this... but I can't get the value of the attribute for the element < YEAR >

    Select r.uwi, r.year
    of tdw_test_xml_files.
    XMLTABLE
    (
    "for $WELL in $ response/WELL/good.
    for $DEPT to $UWIIDX in $WELL, Production, PRODUCING_ENTITY, YEAR
    return < RESULT >
    University of the West Indies West <>{fn:data($WELL/@uwi)} < / UWI >}
    {
    $WELL/production/PRODUCING_ENTITY/YEAR [$UWIIDX]-> (I don't know how to extract the value of the attribute here)
    }
    < / RESULT > '
    passing FILECONTENT as 'GOOD '.
    columns
    UWI VARCHAR (50),
    YEAR vARCHAR2 (24)
    ) r
    /


    If I do this; I get the Cartesian plan result set, which is not my goal

    SELECT xtab.*, xtab2.*
    OF tdw_test_xml_files, XMLTable (' for $i in/Response/Well)
    Return $i"
    PASSAGE filecontent
    Uwi varchar2 COLUMNS (50) PATH'@uwi'
    rn for ORDINALITE
    ) xtab
    , XMLTable (' for $i in/Response/Well/Production/PRODUCING_ENTITY/YEAR)
    Return $i"
    PASSAGE filecontent
    COLUMNS year varchar2 (50) PATH'@NUMBER'
    ) xtab2;

    Any help will be highly appreciated thanks...

    I'm just curious to know how make the query now in unique XMLTable, not that I am forced by using x number of xmltable; - P, just look more clean...

    Here goes:

    SQL> SELECT x.*
      2  FROM tdw_test_xml_files t
      3     , XMLTable(
      4         'for $i in /Response/Well
      5            , $j in $i/Production/PRODUCING_ENTITY/YEAR
      6            , $k in $j/MONTH
      7          return element r {
      8            $i/@uwi
      9          , element year  {data($j/@NUMBER)}
     10          , element month {data($k/@NUMBER)}
     11          }'
     12         passing t.filecontent
     13         columns uwi   varchar2(50) path '@uwi'
     14               , yr    varchar2(4)  path 'year'
     15               , mon   varchar2(2)  path 'month'
     16       ) x
     17  ;
    
    UWI                            YR   MON
    ------------------------------ ---- ---
    102112900816W400               2009 1
    102112900816W400               2009 2
    102112900816W400               2009 3
    102112900816W400               2010 1
    102112900816W400               2010 2
    102112900816W400               2010 3
    102112900816W400               2011 1
    102112900816W400               2011 2
    102112900816W400               2011 3
    102112900816W400               2012 1
    102112900816W400               2012 2
    102112900816W400               2012 3
    100092900816U400               1999 1
    100092900816U400               1999 2
    100092900816U400               1999 3
    100092900816U400               2000 1
    100092900816U400               2000 2
    100092900816U400               2000 3
    100092900816U400               2001 1
    100092900816U400               2001 2
    100092900816U400               2001 3
    100092900816U400               2003 1
    100092900816U400               2003 2
    100092900816U400               2003 3
    
    24 rows selected
     
    
  • Need help to retrieve the value of an xml tag.

    Hi all

    Hello all, I have problem to extract a value from an xml tag. I created an xml schema based on the schema, I created an xmltype table and inserted a value to the table. When I try to extract a value of a particular tag I can't do... Kindly help me to solve this problem. Here by I write all working, I did...

    I use the following client:
    -----------------------------------

    SQL * more: Release 10.2.0.1.0 - Production on Mon 31 Jan 11:44: 59 2011

    Copyright (c) 1982, 2005, Oracle. All rights reserved.


    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With partitioning, OLAP and Data Mining options


    ////////////////////////////////// XML Schema ///////////////////////

    Start
    () dbms_xmlschema.registerSchema
    "http://www.oradev.com/chipsxml.xsd,"
    ' < scheme xmlns = "http://www.w3.org/2001/XMLSchema".
    targetNamespace = "http://www.oradev.com/chipsxml.xsd."
    xmlns:SAMP = "http://www.oradev.com/chipsxml.xsd".
    version = "1.0" >

    < feature name = 'Field1' >
    < complexType >
    <>sequence
    < element name = "UTI" >
    < complexType >
    <>sequence
    < element name = "U01" type = "string" / >
    < element name = "U02" type = "string" / >
    < element name = "U03" type = "string" / >
    < element name = "U03a" type = "string" / >
    < element name = "U03b" type = "string" / >
    < element name = "U03c" type = "string" / >
    < element name = "U04" type = "string" / >
    < element name = "U05" type = "string" / >
    < / sequence >
    < / complexType >
    < / item >
    < / sequence >
    < / complexType >
    < / item >
    < / schema > ',
    (TRUE, TRUE, FALSE, FALSE);
    end;


    A table that has several column.

    CREATE TABLE chipsxmltable1)
    Identification number, XMLDATA XmlType)
    XMLTYPE XMLDATA STORE AS OBJECT / RELATIONAL
    XMLSCHEMA 'http://www.oradev.com/chipsxml.xsd '.
    ELEMENT 'field1 ';


    Insert the query in chipsxmltable.

    INSERT INTO (VALUES) chipsxmltable
    XmlType.CreateXml ("<?") XML version = "1.0"? >
    < xmlns:samp samp: field1 = "http://www.oradev.com/chipsxml.xsd" >
    < USE >
    No. < U01 > < / U01 >
    Y < U02 > < / U02 >
    Y < U03 > < / U03 >
    < U03a > Y < / U03a >
    < U03b > Y < / U03b >
    < U03c > Y < / U03c >
    Y < U04 > < / U04 >
    Y < U05 > < / U05 >
    < / UTI >
    ((< / samp: field1 > '));


    To display the data in a field with the structure:
    --------------------------------------------

    1. motion:
    ----------
    Select * from chipsxmltable1;

    Output:
    -------


    ID XMLDATA
    ---------- -----------------------------------------------------------------
    1 <? XML version = "1.0"? >
    < xmlns:samp samp: field1 = "http://www.oradev.com/chipsxml.xsd" >
    < USE >
    No. < U01 > < / U01 >
    No. < U02 > < / U02 >
    Y < U03 > < / U03 >
    < U03a > Y < / U03a >
    < U03b > Y < / U03b >
    < U03c > Y < / U03c >
    Y < U04 > < / U04 >
    Y < U05 > < / U05 >
    < / UTI >
    < / samp: field1 >


    2 query: (both the query shows the same result)
    ----------

    SELECT X.xmldata.getClobVal ('XMLDATA' FROM chipsxmltable1 X);

    Select extract (XMLDATA, "/ Field1'") .getstringval ("XMLDATA" chipsxmltable1 x);


    Output:
    --------

    XMLDATA
    -----------------------------------------------------------------
    <? XML version = "1.0"? >
    < xmlns:samp samp: field1 = "http://www.oradev.com/chipsxml.xsd" >
    < USE >
    No. < U01 > < / U01 >
    No. < U02 > < / U02 >
    Y < U03 > < / U03 >
    < U03a > Y < / U03a >
    < U03b > Y < / U03b >
    < U03c > Y < / U03c >
    Y < U04 > < / U04 >
    Y < U05 > < / U05 >
    < / UTI >
    < / samp: field1 >


    To display the data as a single string without structure using "getstringval()":
    ---------------------------------------------------------------------------------

    3 query
    ---------

    Select extract (XMLDATA, "//text()').getstringval()"CHIPS - XML"of chipsxmltable1 x;)

    Output:
    -------

    CHIPS - XML
    ---------------------
    NoNoYYYYYY


    To display the data as a single string without structure using "getclobval()":
    ---------------------------------------------------------------------------------

    4 query
    -------

    Select extract (XMLDATA, "//text()').getClobVal()"CHIPS - XML"of chipsxmltable1 x;)

    Output:
    --------

    CHIPS - XML
    -----------------
    NoNoYYYYYY


    To display the data in a tag with or without structure (which does work) using the function "EXTRACT":
    -------------------------------------------------------------------------------------------------------------

    6.query:
    ---------

    Select extract (XMLDATA, "/Field1/text()').getstringval()"XMLDATA' chipsxmltable1 x;

    Select extract (XMLDATA, "/Field1/UTI').getstringval()"XMLDATA' chipsxmltable1 x;

    Select extract (XMLDATA, "/Field1/UTI/U01').getstringval()"XMLDATA' chipsxmltable1 x;

    Select extract (XMLDATA, "/Field1/UTI/U01/text()').getstringval()"XMLDATA' chipsxmltable1 x;


    Output:
    --------

    CHIPS - XML
    ---------------------------------------



    The queries above are not fetch the value.



    To display the data in a tag with or without structure (which does work) using the function "EXTRACTVALUE":
    ------------------------------------------------------------------------------------------------------------------

    7 query:
    ----------

    Select extractValue (XMLDATA, ' / Field1/UTI ') 'XMLDATA' of chipsxmltable1 x;

    Select extractValue (XMLDATA, ' / U01/UTI/Field1 ') 'XMLDATA' of chipsxmltable1 x;


    Output:
    --------

    X
    -



    The queries above are not fetch the value.


    My question is:
    --------------------
    How to extract the values of xml tag when the value are inserted through xml schema?


    My apologies if the description is not clear. Kindly let me know if further details are required. Thanks a lot for your help.

    Very cordially,
    Godwin Castro C.V.

    Hello

    You must declare the namespace of each element used in the XPath expression, like this:

    SQL> select extractvalue( XMLDATA
      2                     , '/samp:Field1/UTI/U01'
      3                     , 'xmlns:samp="http://www.oradev.com/chipsxml.xsd"' ) "XMLDATA"
      4  from chipsxmltable1 x
      5  ;
    
    XMLDATA
    --------------------------------------------------------------------------------
    No
     
    
    SQL> select extract( XMLDATA
      2                , '/samp:Field1/UTI'
      3                , 'xmlns:samp="http://www.oradev.com/chipsxml.xsd"'
      4                ).getstringval() "XMLDATA"
      5  from chipsxmltable1 x
      6  ;
    
    XMLDATA
    --------------------------------------------------------------------------------
    
      No
      Y
      Y
      Y
      Y
      Y
      Y
      Y
    
     
    

    Please see EXTRACT and EXTRACTVALUE documentation:
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions051.htm#i1006712
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions052.htm#SQLRF06173

    BTW, 'XMLDATA' is a pseudo-column used by Oracle. I don't know if it will never cause any conflict, but perhaps you need to rename your column.
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/pseudocolumns010.htm#SQLRF00256

    Kind regards.

  • To extract the value of particular tag of xmlType

    Hello
    The requirement is to extract the value of the specific tab of an XmlType column.

    Here is the schema of the table:
    CREATE TABLE DTCC_REF)
    MESSAGE XMLTYPE NOT NULL,.
    CashFlowId varchar2 (20)
    )

    This table is already filled with only a value in the Message column. cashFlowId is null for all rows.

    Here are examples of MESSAGE data:
    <? XML version = "1.0" encoding = "UTF-8"? > < env:Envelope xmlns:rm = xmlns:pmnt 'OTC_RM_15-Apr-2005' = xmlns:env 'OTC_Payment_15-Apr-2005' = 'http://schemas.xmlsoap.org/soap/envelope/' xmlns:fpml = "http://www.fpml.org/2004/FpML-4-1" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemaLocation = "OTC_RM_15-Apr-2005... «/OTC/OTC_RM_15-Apr-2005.xsd OTC_Payment_15-Apr-2005... http://schemas.xmlsoap.org/soap/envelope/ /xmls/OTC/soap-envelope.xsd /OTC/OTC_Payment_15-Apr-2005.xsd "> < env:Header > < OTC_RM xmlns =" OTC_RM_15-Apr-2005 "> < manifest > < PaymentMsg > < activity > edit < / activity > < status > Matched < / status > < LinkStatus > Linked < / LinkStatus > < TransType > payment < / TransType > < AssetClass > credit < / AssetClass > < DTCCUserId > 00006151» < / DTCCUserId > < CounterpartyId > 00006132 < / CounterpartyId > < / PaymentMsg > < MsgId > 1 < / MsgId > < / Manifest > < / env:Header > < env:Body > < OTC_Payment xmlns = "OTC_Payment_15-Apr-2005" > < payment > < ReferenceIdentifiers > < TradeId > 1001513 M < / TradeId > < ContraTradeId > CREC5856 < / ContraTradeId > < LinkId > LINKEE1DSL890420 < / LinkId > < MatchId > PYMTEKGDRP784788 < / MatchId > < CashFlowId > 2005/12 / 200INTEUREUR1001513M < / CashFlowId > < 61326151EUR1220 NetId > < / NetId > < GroupRefId > < / GroupRefId > < ContraGroupRefId > < / ContraGroupRefId > < / ReferenceIdentifiers > < TradeDetails > < TradeType > EXOTIC < / TradeType > < TradeDate > 2004 - 09 - 13 < / TradeDate > < EffectiveDate > 2004 - 09 - 14 < / EffectiveDate > < ScheduledTerminationDate > 2014 - 09 - 20 < / ScheduledTerminationDate > < NotionalAmount > < fpml : currency > EUR < / fpml:currency > < fpml: Amount > 6000000.00 < / fpml:amount > < / NotionalAmount > < EffectiveRate > 0.3150000 < / EffectiveRate > < ReferenceEntity > < / ReferenceEntity > < / TradeDetails > < SettlementDetails > < SourceSSI > < / SourceSSI > < DestinationSSI > < / DestinationSSI > < / SettlementDetails > < / payment > < / OTC_Payment > < / env : Body > < / env:Envelope >

    Now, I have to fill out the tag CashFlowId value in column 2 of the table.

    How can I retrieve value da? Plase help me...
    SQL> with dtcc_ref as ( select xmltype('
    
      
        
          
            
              Modify
              Matched
              Linked
              Payment
              Credit
              00006151
              00006161
            
            2
          
          
            
              DTCC
              DTCC00006151
            
            
              
                http://db.com/route
                2005-11-26T13:59:29.593Z
                2005-11-26T13:59:29.593Z
              
              
                www.dtcc.net
                2005-11-26T09:47:00.000-05:00
                2005-11-26T09:47:00.000-05:00
              
            
          
        
      
      
        
          
            
              1006299M
              0900000702811
              LINKEBHBKD364294
              PYMTEKUBMKN02373
              2005/12/200INTUSDUSD1006299M
              61516161USD1220
              
              
            
            
              REC
              
                USD
                625625.00
              
              2005-12-20
              Unknown
              Fixed
            
            
              EXO
              2004-09-30
              2004-09-30
              2009-03-20
              
                USD
                247500000.00
              
              1.0000000
              
            
            
              
              
            
          
        
      
    ') xml from dual
    )
    --
    --
    select trim(x.column_value) CashFlowId
      from dtcc_ref t, xmltable('declare namespace e = "OTC_Payment_15-Apr-2005";
                                //e:OTC_Payment//e:CashFlowId/text()' passing t.xml) x
    
    CASHFLOWID
    ------------------------------------------------------
    2005/12/200INTUSDUSD1006299M
    1 row selected.
    
  • Get the table to an XML file with several bays

    Hello

    So I was faced with this program I have for the past few months but I'm almost there. I have a program that creates several berries and place one after the other in an xml file, and each table has its unique name. Now, I would create a VI that takes this XML file and when the user enters the name of the table specific they are seeking it goes into the xml file concludes the table in its entirety under this name and displays in an indicator of output to be read on the VI. A sample of my xml file and the VI that creates this xml file is attached.

    Thank you

    dlovell

    Something like this should work for you.

  • How im can extract the value of the persistence of virtual machine disk?

    Dear friends

    How im can extract the value of the value of the persistence of disks of virtual machines?

    IM using the bellows of the order, I have a if to check if the disks are independent or not

    but im only want values of the persistence of the column to use in my script

    Get-disk hard - vm machine01

    CapacityGB persistence Filename

    ----------      -----------                                                    --------

    10 000 persistent [LUN2] RJ7469SR039/RJ7469SR039.vmdk

    8 000 persistent [rate2] RJ7469SR039/RJ7469SR039_1.vmdk

    Thank you

    Almir

    In your example, you just use Select-Object

    Get-disk hard - vm machine01 | Select the Parent, persistence

    The parent is the name of the virtual machine

  • Extract the value after the period

    Hello

    I am trying to extract the value from each period.

    I have the table data is stored in this mode 172.168.15.10, which is an IP address,.


    My requirement is I need to first value in a query with must return 172
    If I need the value after the second period, it should return 168


    Please suggest me how to write a SQL for the above requirement and oracle 11i Enterprise edition as the database.


    Thank you
    Sudhir

    with regexp

    select
      regexp_substr('172.168.15.10', '\d+', 1, :pos) s
    from dual
    

    without regexp

    select
      substr(s
            , instr(s, '.', 1, :pos) +1
            , instr(s, '.', 1, :pos + 1) - instr(s, '.', 1, :pos) -1
      ) s
    from (select '.'||'172.168.15.10'||'.'
     s  from dual)
    

    Edited by: chris227 the 01.10.2012 01:23

  • With the help of several xml files to complete the 1 form.

    Hi all

    Thank you for reading this.

    My scenario is that I have a form which is the inspection report for a product.

    Once the technician has completed its inspection they fill out the form and send it (which saves the form as xml data in a specific folder on our network.

    Now 1 customer may have up to 10 items to be inspected on a single order. What I have to do is to create a customer report showing them the necessary work on their items.

    Basically, I need to be able to import up to 10 xml files of inspection report in 1 report form.

    I was looking for this with the authorities, but I'm wrong.

    I can get 1 data file imported by using xfa.host.importdata("filename")

    but this method seems to reset the form after the first call to the second instance of the form in the form of report receives all the data. (if this makes no sense at all)

    How can I configure my report form so I can fill different instances of the subform from different xml files?

    that is my xml files names are formatted with call number and line number, e.g. 42E11134 - 5.xml would call no. 42E11134 line 5.

    the folder on the network would have to be 42E11134-10 42E11134-1 (not superior because we cap the maximum points on the same order)

    I need to figurentsur instance subform 1, 42E11134-5 42E11134-1 data displayed on the subform instance 5 etc etc and also recognition of the number of necessary instances (but this could be selected by the user).

    If the authorities do not work I am happy to have 10 separate subforms with different names, but must exist within a single form.

    You can only import a single XML file. You have an xml file that has multiple instances of data, but it must be a single xml file.

    So you should find a way to combine all these into a single xml files then do the import.

    Paul

  • Extract the value between the xml tags in the XML inside the BLOB field

    Hello

    I have a table that contains a BLOB column, this XML file to store column that received from an external source. Now for one of my needs. I need to read that value is the specific XML tag and create the entry in the database.

    Column name DataType
    IDNumber
    RecordBLOB OBJECT

    This is the XML code that is stored in the file inside the BLOB field format. XML below, I need go get AMC1234 there is after < itemName > text < / itemName > I thought to use XMLTYPE, but unfortunately my DBA team does not XML database, I now use UTL_RAW. CAST_TO_VARCHAR2 and recovery entire string, but I am not able to read actual result it takes. Can someone help me remove AMC1234.

    <? XML version = "1.0"? >

    <! DOCTYPE importFile SYSTEM "xyz.dtd" >

    -< importFile >

    -< importResult >

    < mode status = "DΘFINIR" > general failure < / status >

    < statusCode > 1 < / statusCode >

    invalid < errorMsg > list and holiday component < / errorMsg >

    -< returnInfo >

    < itemName > PRQ < / itemName >

    < Valeurelement > CBA < / Valeurelement >

    < / returnInfo >

    -< returnInfo >

    < itemName > LMP < / itemName >

    < Valeurelement > CBA < / Valeurelement >

    < / returnInfo >

    -< returnInfo >

    < itemName > KEY < / itemName >

    < Valeurelement > 9999 < / Valeurelement >

    < / returnInfo >

    -< returnInfo >

    < itemName > text < / itemName >

    < Valeurelement > AMC1234, FIXED_ALL, RED < / Valeurelement >

    < / returnInfo >

    < / importResult >

    < / importFile >


    Thank you

    Without

    Without - try something like...

    with t as (select"

    -

    -

    General failure

    1

    component and invalid vacation list

    -

    PRQ

    ABC

    -

    LMP

    ABC

    -

    KEY

    9999

    -

    Text

    AMC1234, FIXED_ALL, RED

    "the double pass."

    )

    Select Replace (regexp_substr (col,'([^<>']) itemName))

    , replace (regexp_substr (col,'([^<>""]) Valeurelement))

    t

    connection of level <=> ');

  • Extract the value of the node with multiple namespace xml

    Hello

    I have to extract values in xml that includes several namepspaces. a single namespace has value of xmlns. I managed to get the value of the node for tag event where as info tag returns null.

    experrts need help.

    <? XML version = "1.0" encoding = "utf-8"? >

    < event xmlns = " " http://www.w3.org/2001/XMLSchema-instance ' >

    < data xmlns = ">

    < object >

    < eventtype > 110 < / eventtype >

    < result > < / result >

    < / object > < / data >

    < xmlns = info "> < jref > JREF < / jref >

    < / info >

    < / event >

    SELECT

    TMX.eventtype,

    TMX.result,

    TMX.jref

    of EXAMPLE_MESSAGES1.

    XMLTABLE (XMLNAMESPACES (DEFAULT 'http://www.w3.org/2001/XMLSchema-instance'), )

    ' for $i in/event/data/object

    Returns the local item: r {$i / eventtype,}

    $i / result.

    {$i / jref}'

    EXAMPLE_MESSAGES1 OF PASSAGE. XML_MESSAGE

    COLUMNS

    EVENTTYPE VARCHAR2 (30) PATH "eventtype"

    RESULT VARCHAR2 (30) PATH 'result ',.

    TMX JREF PATH VARCHAR2 (30) 'jref');

    Version of the database is 11.2.0.3.0

    Hello

    I have to extract values in xml that includes several namepspaces.

    There is only one workspace names in fact (the default value).

    Normally, an empty xmlns UN-declare a default namespace declaration is inherited from the parent node.

    So, in your example, only node belongs to the default namespace.

    In this case, when you have to walk through the nodes belonging to some namespaces and others in any namespace, do not use the DEFAULT option in the WITH XMLNAMESPACES.

    Instead, declare a prefix and use it as needed for qualify of nodes.

    Another thing:

    Returns the local item: r {$i / eventtype,}

    What what do you want with "local:" here?

    The following should give the expected results:

    SELECT TMX.*

    of EXAMPLE_MESSAGES1

    XMLTABLE)

    XMLNAMESPACES ("http://www.w3.org/2001/XMLSchema-instance" as "ns0")

    , ' / ns0:event'

    EXAMPLE_MESSAGES1 OF PASSAGE. XML_MESSAGE

    COLUMNS

    EVENTTYPE VARCHAR2 (30) PATH 'data, object, eventtype.

    , RESULT VARCHAR2 (30) PATH ' object/data/result '.

    , PATH of VARCHAR2 (30) JREF ' info/jref.

    ) TMX;

  • How to update day/change the value stored in a file XML with AS3

    I have the following xml file...

    <Customers>
         <Email address="[email protected]">
              <FName>joe</FName>
              <Surname>bloggs</Surname>
              <DayBirth>02</DayBirth>
              <MonthBirth>01</MonthBirth>
              <YearBirth>1981</YearBirth>
              <House>2</House>
              <Address1>Johns Street</Address1>
              <Address2>Trekville</Address2>     
              <City>Timbuktoo</City>
              <PostCode>CF67TH</PostCode>
              <Gender>Male</Gender>
         </Email>

         <Email address="[email protected]">
              <FName>fred</FName>
              <Surname>bloggs</Surname>
              <DayBirth>03</DayBirth>
              <MonthBirth>02</MonthBirth>
              <YearBirth>1982</YearBirth>
              <House>22</House>
              <Address1>Johns Street</Address1>
              <Address2>Fredville</Address2>
              <City>Cardiff</City>
              <PostCode>CF71TH</PostCode>
              <Gender>Male</Gender>
         </Email>
    </Customers>


    I loaded the XMLfile in my flash site and I am able to filter by the email address and display the corresponding data. Code below...

    var custXML:XMLList;

    var xmlCustLoader:URLLoader = new URLLoader();

    xmlCustLoader.load (new URLRequest ("Customers.xml"));

    xmlCustLoader.addEventListener (Event.COMPLETE, custXMLLoaded);

    function custXMLLoaded(e:Event):void {}

    xmlCustLoader.removeEventListener (Event.COMPLETE, custXMLLoaded);

    load xml in object custXML data

    custXML = new XMLList (e.target.data);

    run the analysis function

    ParseCustomer (custXML);

    }

    function ParseCustomer(customerInput:XMLList):void {}

    trace ("Output XML");

    trace("------------------------");

    var custAtts:XMLList = customerInput.Email. (@address is entEmail;)

    for each {(var custEmail:XML in custAtts)

    trace (custEmail);

    }

    set variables for the filtered result

    entFName = customerInput.Email. (@address is entEmail). FName;

    entSurname = customerInput.Email. (@address is entEmail). Family name;

    entDay = customerInput.Email. (@address is entEmail). DayBirth;

    entMonth = customerInput.Email. (@address is entEmail). MonthBirth;

    entYear = customerInput.Email. (@address is entEmail). YearBirth;

    entHouse = customerInput.Email. (@address is entEmail). House;

    entAdd1 = customerInput.Email. (@address is entEmail). Address1;

    entAdd2 = customerInput.Email. (@address is entEmail). Address2;

    entCity = customerInput.Email. (@address is entEmail). City;

    entPCode = customerInput.Email. (@address is entEmail). Postal code;

    entGender = customerInput.Email. (@address is entEmail). Gender;

    }

    Now, I want to edit a record in this file (for example, change the < FName > Fred to say Paul and save the changes to the Customers.xml.) How can I do this?

    It's because you're not assign the name of the film, time, etc. and I only showed how to solve the problem you asked originally.

    now, ask yourself a different (but related) question.  Here is the solution:

    seat of the var: int;

    var chosenSeat:String;

    b.addEventListener (MouseEvent.CLICK, seat1Click);

    function seat1Click(event:MouseEvent):void {}

    seat = 1;

    set the chosenSeat to the name of the XML tag Seat1 - this will be used to record

    chosenSeat = "Seat1;

    instead of hard-coding these channels, they should be attributed using comboboxes or something else.

    UpdateBooking (bookXML, chosenSeat, seat, "St Davids", "300: Empire builders", "Tuesday", "18:00");

    }

    function UpdateBooking(xml:XML,chosenSeat:String,seat:int,room_name:String,movie_title:String,day__name:String,showing_time:String):void {}

    XML. room. (@name is room_name). Film. (@title is movie_title). Day. (@name is day_name). Display. (@t ime is showing_time) [chosenSeat] = seat;

    }

Maybe you are looking for