Extract value from XML column .

Hi,
I'm on 11.2.0.3 and got query
select other_xml from v$sql_plan where sql_id=’2y32qkr40b82a’ and other_xml is not null
<other_xml><info type="db_version">11.2.0.3</info>
<info type="parse_schema"><![CDATA["LIU"]]></info><info type="dynamic_sampling">2</info>
<info type="plan_hash">3882242470</info><info type="plan_hash_2">281948136</info>
<peeked_binds><bind nam=":N1" pos="1" dty="2" pre="0" scl="0" mxl="22">c30d51</bind>
<bind nam=":N2" pos="2" dty="2" pre="0" scl="0" mxl="22">c30d51</bind>
<bind nam=":N3" pos="3" dty="2" pre="0" scl="0" mxl="22">c30d51</bind></peeked_binds>
<outline_data><hint><![CDATA[IGNORE_OPTIM_EMBEDDED_HINTS]]></hint>
<hint><![CDATA[OPTIMIZER_FEATURES_ENABLE('11.2.0.3')]]></hint>
<hint><![CDATA[DB_VERSION('11.2.0.3')]]></hint>
<hint><![CDATA[FIRST_ROWS(100)]]></hint>
<hint><![CDATA[OUTLINE_LEAF(@"SEL$1")]]></hint>
<hint><![CDATA[FULL(@"SEL$1" "LIU"@"SEL$1")]]></hint>
</outline_data></other_xml>I want output related to <info type="dynamic_sampling">2</info> :
column name dynamic_sampling
row value 2
on the second thought using dynamic_sampling value as a predicate would be great so:
select * from v$sql_plan
where
dynamic_sampling = 2
how to transform other_xml column to have such results ?
Regards
GregG
Edited by: GregG on Feb 8, 2013 1:14 PM

And here is an xmltable version:
select p.sql_id, t.val
from   v$sql_plan p
,      xmltable('for $i in /other_xml/info
                 where $i/@type eq "dynamic_sampling"
                 return $i'
                passing xmltype(p.other_xml)
                columns attr varchar2(50) path '@type',
                        val  varchar2(50) path '/') t
where  p.other_xml is not null;This works for me in 11.2.0.3 but crashes in 11.1.0.7 with ORA-00600: internal error code, arguments: [qctVCO:csform], [0], [0], [0], [0], [112], [2], [224], [], [], [], []

Similar Messages

  • Extract data from xml column to other table

    Hi
    I have a table with clob column, inside have a xml, How can I to extract data inside column
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    PL/SQL Release 9.2.0.8.0 - Production
    CORE     9.2.0.8.0     Production
    TNS for IBM/AIX RISC System/6000: Version 9.2.0.8.0 - Production
    NLSRTL Version 9.2.0.8.0 - Production

    thank you
    I have a table
    SQL> desc xml_documents;
    Name      Type          Nullable Default Comments
    DOCNAME   VARCHAR2(200)                          
    XMLDOC    CLOB          Y                        
    TIMESTAMP DATE          Y                         inside XMLDOC column there is only a record below
    <!-- claim77804.xml -->
    <Claim>
    <ClaimId>77804</ClaimId>
    <Policy>12345</Policy>
    <Settlements>
    <Payment Approver="JCOX">1000</Payment>
    <Payment Approver="PSMITH">1850</Payment>
    </Settlements>
    <DamageReport>
    The insured's <Vehicle Make="Volks">Beetle</Vehicle>
    broke through the guard rail and plummeted into a ravine.
    The cause was determined to be <Cause>faulty brakes</Cause>.
    Amazingly there were no casualties.
    </DamageReport>
    </Claim>I tried to use example from : http://www.oracle-base.com/articles/9i/xmlsequence.php
    SELECT extract(value(d), '//POLICY/text()').getStringVal() AS empno
    FROM    xml_documents x,
           table(xmlsequence(extract(x.xmldoc, '/ROWSET/Claim'))) d;But no work, show me error
    ORA-00932: inconsistent datatypes: expected - got -

  • Extracting value from XML tags in Java

    Hi all,
    I need to extract the value from a string (XML Format). Eg. <Name>Ray</Name> and displaying Name: Ray
    The string value is like any other String class object except that it is format with XML tags. I have quite a few examples that shows how a value can be read from a .xml file but none that describe how to get a value from a String object.
    Thanks in advance.

                         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder parser = factory.newDocumentBuilder();
         Document document = parser.parse("Your XML Goes here ");

  • Extracting Values from XML-Document in pl/sql

    Hello!
    I need to extract the content of the following extract:
    <ns1:OXERPGetArticlesResponse xmlns:ns1="OXERPService">
    <ns1:OXERPGetArticlesResult>
    <ns1:OXERPType>
    <ns1:aResult>
    <ns1:ArrayOfString>
    <ns1:string>OXID</ns1:string>
    <ns1:string>531f91d4ab8bfb24c4d04e473d246d0b</ns1:string>
    </ns1:ArrayOfString>
    <ns1:ArrayOfString>
    <ns1:string>OXARTNUM</ns1:string>
    <ns1:string>0601-85-069</ns1:string>
    </ns1:ArrayOfString>
    <ns1:ArrayOfString>
    <ns1:string>OXPRICE</ns1:string>
    <ns1:string>100.5</ns1:string>
    </ns1:ArrayOfString>
    </ns1:aResult>
    <ns1:blResult>true</ns1:blResult>
    <ns1:sMessage/>
    </ns1:OXERPType>
    <ns1:OXERPType>
    <ns1:aResult>
    <ns1:ArrayOfString>
    <ns1:string>OXID</ns1:string>
    <ns1:string>531a8af7d9a9a5bb53b65a2b9a5356e5</ns1:string>
    </ns1:ArrayOfString>
    <ns1:ArrayOfString>
    <ns1:string>OXARTNUM</ns1:string>
    <ns1:string>0601-85-069-1</ns1:string>
    </ns1:ArrayOfString>
    <ns1:ArrayOfString>
    <ns1:string>OXPRICE</ns1:string>
    <ns1:string>89.9</ns1:string>
    </ns1:ArrayOfString>
    </ns1:aResult>
    <ns1:blResult>true</ns1:blResult>
    <ns1:sMessage/>
    </ns1:OXERPType>
    </ns1:OXERPGetArticlesResult>
    </ns1:OXERPGetArticlesResponse>
    The output should be:
    OXID OXARTNUM OXPRICE
    531f91d4ab8bfb24c4d04e473d246d0b 0601-85-069 100.5
    531a8af7d9a9a5bb53b65a2b9a5356e5 0601-85-069-1 89.9
    The count of rows and columns is variable.
    I want to do this by using xmltype.extract but I found no way to create a loop over the content of the xml document.
    Hopefully someone can help me!
    Regards
    Herbert

    OK, then you should be able to use something like :
    SQL> var xmldoc clob;
    SQL> begin
      2   :xmldoc := '<ns1:OXERPGetArticlesResponse xmlns:ns1="OXERPService">
      3  <ns1:OXERPGetArticlesResult>
      4  <ns1:OXERPType>
      5  <ns1:aResult>
      6  <ns1:ArrayOfString>
      7  <ns1:string>OXID</ns1:string>
      8  <ns1:string>531f91d4ab8bfb24c4d04e473d246d0b</ns1:string>
      9  </ns1:ArrayOfString>
    10  <ns1:ArrayOfString>
    11  <ns1:string>OXARTNUM</ns1:string>
    12  <ns1:string>0601-85-069</ns1:string>
    13  </ns1:ArrayOfString>
    14  <ns1:ArrayOfString>
    15  <ns1:string>OXPRICE</ns1:string>
    16  <ns1:string>100.5</ns1:string>
    17  </ns1:ArrayOfString>
    18  </ns1:aResult>
    19  <ns1:blResult>true</ns1:blResult>
    20  <ns1:sMessage/>
    21  </ns1:OXERPType>
    22  <ns1:OXERPType>
    23  <ns1:aResult>
    24  <ns1:ArrayOfString>
    25  <ns1:string>OXID</ns1:string>
    26  <ns1:string>531a8af7d9a9a5bb53b65a2b9a5356e5</ns1:string>
    27  </ns1:ArrayOfString>
    28  <ns1:ArrayOfString>
    29  <ns1:string>OXARTNUM</ns1:string>
    30  <ns1:string>0601-85-069-1</ns1:string>
    31  </ns1:ArrayOfString>
    32  <ns1:ArrayOfString>
    33  <ns1:string>OXPRICE</ns1:string>
    34  <ns1:string>89.9</ns1:string>
    35  </ns1:ArrayOfString>
    36  </ns1:aResult>
    37  <ns1:blResult>true</ns1:blResult>
    38  <ns1:sMessage/>
    39  </ns1:OXERPType>
    40  </ns1:OXERPGetArticlesResult>
    41  </ns1:OXERPGetArticlesResponse>';
    42  end;
    43  /
    Procédure PL/SQL terminée avec succès.
    SQL> SELECT x1.rec_id
      2       , x2.col_name
      3       , x2.col_value
      4  FROM XMLTable(
      5        XMLNamespaces('OXERPService' as "ns1"),
      6        '/ns1:OXERPGetArticlesResponse/ns1:OXERPGetArticlesResult/ns1:OXERPType/ns1:aResult'
      7        passing xmltype(:xmldoc)
      8        columns rec_id for ordinality
      9              , rec_xml xmltype path 'ns1:ArrayOfString'
    10       ) x1,
    11       XMLTable(
    12        XMLNamespaces('OXERPService' as "ns1"),'/ns1:ArrayOfString'
    13        passing x1.rec_xml
    14        columns col_name  varchar2(30) path 'ns1:string[1]'
    15              , col_value varchar2(30) path 'ns1:string[2]'
    16       ) x2
    17  ;
        REC_ID COL_NAME                       COL_VALUE
             1 OXID                           531f91d4ab8bfb24c4d04e473d246d
             1 OXARTNUM                       0601-85-069
             1 OXPRICE                        100.5
             2 OXID                           531a8af7d9a9a5bb53b65a2b9a5356
             2 OXARTNUM                       0601-85-069-1
             2 OXPRICE                        89.9
    6 ligne(s) sélectionnée(s).You mentioned that the number of column(s) is not known in advance. That's gonna be a problem to present the data column-wise.
    Version 11g has the PIVOT feature, but still you have to know how many columns there will be in the result set.
    How are you going to use the data after extraction?
    Maybe we could advise some other techniques more relevant for your requirement.

  • Help needed in extracting values from XML

    SAMPLE XML:
    - <Form1>
    - <Name>
    <Ttl>MR</Ttl>
    <Fore>ABC1</Fore>
    <Sur>XYZ2</Sur>
    </Name>
    - <Address>
    <Line>ADD_LINE_1</Line>
    <Line>ADD_LINE_2</Line>
    <PostCode>PST CDE</PostCode>
    </Address>
    <BirthDate>0001-01-01</BirthDate>
    - <Details>
    <TotalEarnings>1234567.00</TotalEarnings>
    <TotalDeduction>12345.00</TotalDeduction>
    </Details>
    </Form1>
    - <Form1>
    - <Name>
    <Ttl>MR</Ttl>
    <Fore>ABC2</Fore>
    <Sur>XYZ2</Sur>
    </Name>
    - <Address>
    <Line>ADD_LINE_3</Line>
    <Line>ADD_LINE_4</Line>
    <PostCode>PST CDE</PostCode>
    </Address>
    <BirthDate>0002-02-02</BirthDate>
    <Gender>female</Gender>
    - <Details>
    <TotalEarnings>12345.00</TotalEarnings>
    <TotalDeduction>123.00</TotalDeduction>
    </Details>
    </Form1>
    There can be any 'n' number of <Form1>'s in one XML.But I want to get only the details of the person whose TotalEarnings>1million. Details include
    Name->Ttl,Fore,Sur
    which in this case would be MR,ABC1,XYZ1
    Address->Line,Line,Postcode
    which in this case would be ADD_LINE_1,ADD_LINE_2,PST CDE
    Birthdate
    which in this case would be 0001-01-01
    Gender
    which in this case would be "null" as there is no Gender tag present
    Details->TotalEarnings,TotalDeduction
    which in this case would be 1234567.00,12345.00
    The technique I was using is,
    1. Convert to clob
    2. User dbms_instr find the location of <Form1> in a loop
    3. For every occurence of <Form1> I find <TotalEarnings> value and check if this is greater than 1 million.
    4. If true, I use dbms_instr to get the values of all the tags inside <Form1>
    5. The drawback of using dbms_instr is that it gets the value of first occurence of whatever sting we supply.In this case dbms_instr(xml,'<Gender>',position of Form1) will not return null whereas it will return "Female" from the next form. This is wrong as it doesnt belong to the person who earns more than a million.
    Can anyone suggest a way to fetch the values that only belong to the form of the person who earns more than a million?

    There can be any 'n' number of <Form1>'s in one
    XML.Not if you want the XML to be valid there can't. You would need a root element around all the <Form1>'s to make it valid.
    The technique I was using is,
    1. Convert to clob
    2. User dbms_instr find the location of <Form1> in a
    loop
    3. For every occurence of <Form1> I find
    <TotalEarnings> value and check if this is greater
    than 1 million.
    4. If true, I use dbms_instr to get the values of all
    the tags inside <Form1>
    5. The drawback of using dbms_instr is that it gets
    the value of first occurence of whatever sting we
    supply.In this case
    dbms_instr(xml,'<Gender>',position of Form1) will not
    return null whereas it will return "Female" from the
    next form. This is wrong as it doesnt belong to the
    person who earns more than a million.
    Can anyone suggest a way to fetch the values that
    only belong to the form of the person who earns more
    than a million?Why on earth are you using dbms_instr for this? Oracle has built in XML functionality for use against XMLTYPE data, such as the ExtractValue method and the use of XPATH expressions.
    I'd suggest you start reading some of the manuals regarding XML functionality in Oracle rather than trying to manually parse it all.

  • Sql to extract data from XML column

    Hi I am able to get the the following data to Apex_collection,
    Can you help me how to transform it to muliple rows for EventNumber,EventDesc columns.
    I have tried with Extractvalue it returns null.
    <?xml version="1.0" encoding="ISO-8859-1"?> <ResultSet><DataRow><EventNumber>3</EventNumber><StartDate>03/10/2007</StartDate><EventDesc>Networking Skills</EventDesc><EventReference></EventReference><NumberOfAttendees>0</NumberOfAttendees><MaximumAttendees>45</MaximumAttendees><NumberOnWaitingList>0</NumberOnWaitingList><NumberInterested>0</NumberInterested><SubjectDesc>Skills Session</SubjectDesc><SkillLevelDesc>Group</SkillLevelDesc><EventStatus>TAKI</EventStatus><VenueDesc>LTG</VenueDesc><Template>N</Template><MultiSession>Y</MultiSession><EventClass>AMBA</EventClass></DataRow><DataRow><EventNumber>8</EventNumber><StartDate>10/10/2007</StartDate><EventDesc>Demystifying to IB</EventDesc><EventReference></EventReference><NumberOfAttendees>0</NumberOfAttendees><MaximumAttendees>45</MaximumAttendees><NumberOnWaitingList>0</NumberOnWaitingList><NumberInterested>0</NumberInterested><SubjectDesc>Workshop</SubjectDesc><SkillLevelDesc>Group</SkillLevelDesc><EventStatus>TAKI</EventStatus><VenueDesc>LTG</VenueDesc><Template>N</Template><MultiSession>Y</MultiSession><EventClass>AMBA</EventClass></DataRow><DataRow><EventNumber>14</EventNumber><StartDate>16/10/2007</StartDate><EventDesc>Bank of England Grad Presentation</EventDesc><EventReference></EventReference><NumberOfAttendees>0</NumberOfAttendees><MaximumAttendees>40</MaximumAttendees><NumberOnWaitingList>0</NumberOnWaitingList><NumberInterested>0</NumberInterested><SubjectDesc>Recruitment Presentation</SubjectDesc><SkillLevelDesc>Group</SkillLevelDesc><EventStatus>TAKI</EventStatus><VenueDesc>LTG</VenueDesc><Template>N</Template><MultiSession>Y</MultiSession><EventClass>AMSC</EventClass></DataRow><DataRow><EventNumber>17</EventNumber><StartDate>17/10/2007</StartDate><EventDesc>Effective use of the alumni network</EventDesc><EventReference></EventReference><NumberOfAttendees>0</NumberOfAttendees><MaximumAttendees>45</MaximumAttendees><NumberOnWaitingList>0</NumberOnWaitingList><NumberInterested>0</NumberInterested><SubjectDesc>Other</SubjectDesc><SkillLevelDesc>Group</SkillLevelDesc><EventStatus>TAKI</EventStatus><VenueDesc>LTG</VenueDesc><Template>N</Template><MultiSession>N</MultiSession><EventClass>AMBA</EventClass></DataRow><DataRow><EventNumber>18</EventNumber><StartDate>17/10/2007</StartDate><EventDesc>Personal Brand</EventDesc><EventReference></EventReference><NumberOfAttendees>0</NumberOfAttendees><MaximumAttendees>45</MaximumAttendees><NumberOnWaitingList>0</NumberOnWaitingList><NumberInterested>0</NumberInterested><SubjectDesc>Workshop</SubjectDesc><SkillLevelDesc>Group</SkillLevelDesc><EventStatus>TAKI</EventStatus><VenueDesc>LTG</VenueDesc><Template>N</Template><MultiSession>Y</MultiSession><EventClass>AMBA</EventClass></DataRow><DataRow><EventNumber>19</EventNumber><StartDate>17/10/2007</StartDate><EventDesc>Speed Reading</EventDesc><EventReference></EventReference><NumberOfAttendees>0</NumberOfAttendees><MaximumAttendees>20</MaximumAttendees><NumberOnWaitingList>0</NumberOnWaitingList><NumberInterested>0</NumberInterested><SubjectDesc>Workshop</SubjectDesc><SkillLevelDesc>Group</SkillLevelDesc><EventStatus>TAKI</EventStatus><VenueDesc>LTG</VenueDesc><Template>N</Template><MultiSession>Y</MultiSession><EventClass>AMBA</EventClass></DataRow><DataRow><EventNumber>22</EventNumber><StartDate>18/10/2007</StartDate><EventDesc>Morgan Stanley - Applying to IB</EventDesc><EventReference></EventReference><NumberOfAttendees>0</NumberOfAttendees><MaximumAttendees>30</MaximumAttendees><NumberOnWaitingList>0</NumberOnWaitingList><NumberInterested>0</NumberInterested><SubjectDesc>Recruitment Presentation</SubjectDesc><SkillLevelDesc>Group</SkillLevelDesc><EventStatus>TAKI</EventStatus><VenueDesc>LTG</VenueDesc><Template>N</Template><MultiSession>Y</MultiSession><EventClass>MSCFINRISK</EventClass></DataRow><DataRow><EventNumber>27</EventNumber><StartDate>22/10/2007</StartDate><EventDesc>Power &Energy Group</EventDesc><EventReference></EventReference><NumberOfAttendees>0</NumberOfAttendees><MaximumAttendees>30</MaximumAttendees><NumberOnWaitingList>0</NumberOnWaitingList><NumberInterested>0</NumberInterested><SubjectDesc>Recruitment Presentation</SubjectDesc><SkillLevelDesc>Group</SkillLevelDesc><EventStatus>TAKI</EventStatus><VenueDesc>LTG</VenueDesc><Template>N</Template><MultiSession>Y</MultiSession><EventClass>ACP</EventClass></DataRow></ResultSet>

    Or if you have oracle version >= 10gR2 then this is better:
    select b.* from
      (SELECT xmltype(:your_xml) your_xml FROM dual) a,
      XMLTable
      ('/ResultSet/DataRow'
        PASSING a.your_xml
        COLUMNS
          EventNumber varchar2(10) PATH '/DataRow/EventNumber',
          EventDesc varchar2(10) PATH '/DataRow/EventDesc'
      ) bBest regards,
    Hrvoje.

  • Regular expression to extract value from xml

    Hi,
    I need to extract the value of an XML tag.
    <purchaseId>Best-200423</purchaseId>
    The result of the expression should be: "Best-200423".
    Something like this ([^\\<purchaseId\\>]*[^\\</purchaseId\\>]) does not work.
    Does somebody has a soltuion?
    I can't get it to work! I want to use the Java Regular Expression functionality.
    Best wishes
    Jochen

    You got lucky, is all. Try changing "Best" to "pest" in your example and it won't work. The square brackets are spurious, and you want m.getGroup(1) to get the stuff that matches the () group.
    Square brackes mean "match any of the characters in the brackets". [^ means "match any character not in this list").                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Need help in extracting value from an xml tag.

    Hi ALL,
    Good Morning to all, i have problem in fetching a value from a xml tag. I have created a xml schema based on the schema i have created a xmltype table and inserted a value to the table. When i am trying to fetch a value from a particular tag i am unable to do so.. Kindly help me to solve this. Here by i am posting all the workings i have done...
    I am using the following client:
    SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 31 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 the Partitioning, OLAP and Data Mining options
    ////////////////////////////////// XML Schema ///////////////////////
    begin
    dbms_xmlschema.registerSchema(
    'http://www.oradev.com/chipsxml.xsd',
    '<schema 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">
    <element 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>
         </element>
    </sequence>
    </complexType>
    </element>
    </schema>',
    TRUE, TRUE, FALSE, FALSE);
    end;
    ////////////////////////// Table which has multiple Column //////////////////////////
    CREATE TABLE chipsxmltable1 (
    id number, XMLDATA XmlType)
    XMLTYPE XMLDATA STORE AS OBJECT RELATIONAL
    XMLSCHEMA "http://www.oradev.com/chipsxml.xsd"
    ELEMENT "Field1";
    ///////////////////////////////// Insert Query in chipsxmltable //////////////////////////
    INSERT INTO chipsxmltable VALUES(
    xmltype.createxml('<?xml version="1.0"?>
    <samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd" >
    <UTI>
    <U01>No</U01>
    <U02>Y</U02>
    <U03>Y</U03>
    <U03a>Y</U03a>
    <U03b>Y</U03b>
    <U03c>Y</U03c>     
    <U04>Y</U04>
    <U05>Y</U05>          
    </UTI>
    </samp:Field1>'));
    To show the data as a field with structure:
    1. Query:
    Select * from chipsxmltable1;
    Output:
    ID XMLDATA
    1 <?xml version="1.0"?>
    <samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd">
    <UTI>
    <U01>No</U01>
    <U02>No</U02>
    <U03>Y</U03>
    <U03a>Y</U03a>
    <U03b>Y</U03b>
    <U03c>Y</U03c>
    <U04>Y</U04>
    <U05>Y</U05>
    </UTI>
    </samp:Field1>
    2. Query: (Both the query displays the same Output)
         SELECT X.xmldata.getClobVal() "XMLDATA" FROM chipsxmltable1 X;
         select extract(XMLDATA, '/Field1').getstringval() "XMLDATA" from chipsxmltable1 x;
    Output:
    XMLDATA
    <?xml version="1.0"?>
    <samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd">
    <UTI>
    <U01>No</U01>
    <U02>No</U02>
    <U03>Y</U03>
    <U03a>Y</U03a>
    <U03b>Y</U03b>
    <U03c>Y</U03c>
    <U04>Y</U04>
    <U05>Y</U05>
    </UTI>
    </samp:Field1>
    To show the data as a single string without structure using "getstringval()":
    3. Query
         select extract(XMLDATA, '//text()').getstringval() "CHIPS - XML" from chipsxmltable1 x;
    OUtput:
    CHIPS - XML
    NoNoYYYYYY
    To show the data as a single string without structure using "getclobval()":
    4.Query
         select extract(XMLDATA, '//text()').getClobVal() "CHIPS - XML" from chipsxmltable1 x;
    Output:
    CHIPS - XML
    NoNoYYYYYY
    To show the data in a particular tag with/Without structure (Which is not working) using "EXTRACT" function:
    6.Query:
         select extract(XMLDATA, '/Field1/text()').getstringval() "XMLDATA" from chipsxmltable1 x;
         select extract(XMLDATA, '/Field1/UTI').getstringval() "XMLDATA" from chipsxmltable1 x;
         select extract(XMLDATA, '/Field1/UTI/U01').getstringval() "XMLDATA" from chipsxmltable1 x;
         select extract(XMLDATA, '/Field1/UTI/U01/text()').getstringval() "XMLDATA" from chipsxmltable1 x;
    Output:
    CHIPS - XML
    The above queries are not fetching the value.
    To show the data in a particular tag with/Without structure (Which is not working) using "EXTRACTVALUE" function:
    7. Query:
         select extractValue(XMLDATA, '/Field1/UTI') "XMLDATA" from chipsxmltable1 x;
         select extractValue(XMLDATA, '/Field1/UTI/U01') "XMLDATA" from chipsxmltable1 x;
    Output:
    X
    The above queries are not fetching the value.
    My question is:
    How to fetch values from xml tag when the value are inserted through xml schema?
    Apologies if the description is not clear. Kindly let me know if further details are needed. Many thanks for your help.
    Very best regards,
    Godwin Jebakumar C.V.

    Hi,
    You need to 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
    <UTI>
      <U01>No</U01>
      <U02>Y</U02>
      <U03>Y</U03>
      <U03a>Y</U03a>
      <U03b>Y</U03b>
      <U03c>Y</U03c>
      <U04>Y</U04>
      <U05>Y</U05>
    </UTI>
    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'll ever cause any conflict but maybe you should rename your column.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/pseudocolumns010.htm#SQLRF00256
    Regards.

  • [Forum FAQ] SharePoint 2013: Extracting values from a multi-value enabled lookup column and merge values to a multi-value enabled column

    For some business requirements, users want to extract values from a multi-value enabled lookup column
    and add items to another list based on each separate value. In contrast, others want to find duplicate values in the list and merge associated values to a multi-value enabled column and then
    add items to another list based on the merged value. All of these can be achieved using SharePoint Designer 2013 Workflow.
    How to extract values from a multi-value enabled lookup column and add items to another list based
    on each separate value using SharePoint Designer 2013.
    Important actions: Loop Shape; Utility Actions
    Three scenarios
    Things to note
    Steps to create Workflow
    How to merge values to a multi-value enabled column and add item to another list based on the
    merged value using SharePoint Designer 2013.
    Important actions: Call HTTP Web Service; Build Dictionary
    Things to note
    Steps to create Workflow
    How to
    extract values from a multi-value enabled lookup column and
    add items to another list based on each separate value using SharePoint Designer 2013.
    For example, they have three lists as below. They want to
    extract values from the Destinations column
    in Lookup2 and add items to Lookup3 based on each country and set Title to current item: ID.
    Lookup1:
    Title (Single line of text)
    Lookup2:
    Title (Single line of text), Destinations (Lookup; Get information from: Lookup1 in Title column).\
    Lookup3:
    Title (Single line of text), Country (Single line of text).
    Important action
    1. Loop Shape: SharePoint Designer 2013 support two types of loops: loop n times and loop with condition.
    Loops must also conform to the following rules:
    Loops must be within a stage, and stages cannot be within a loop.
    Steps may be within a loop.
    Loops may have only one entry and one exit point.
    2. Utility Actions: It contains many actions, such as ‘Extract Substring from Index of String’ and ‘Find substring in String’.
    Three scenarios
    We need to loop through the string returned from the look up column and look for commas. There are three
    scenarios:
    1.  No comma but string is non-empty so there is only one country.
    2.  At least one comma so there is at least two or more countries to loop.
    3.  In the loop we have consumed all the commas so we have found the last country. 
    Things to note
    There are two things to note:
    1. "Find string in string (output to Variable:index)"  will return -1 if doesn't find
    the searched for string.
    2. In the opening statement "Set Variable: Countries to Current Item:Destinations" set the return
    field as  "Lookup Values, Comma Delimited".
    Steps to create Workflow
    Create a custom list named Lookup1.
    Create a custom list named Lookup2, add column: Destinations (Lookup; Get information from: Lookup1 in Title column).
    Create a custom list named Lookup3, add column: Country (Single line of text).
    Create a workflow associated to Lookup2.
    Add conditions and actions:
    Start the workflow automatically when an item is created.
    Add item to Lookup2, then workflow will be started automatically and create multiple items to lookup3.
    See the below in workflow History List:
    How to merge values to a multi-value enabled column and add item to another list based on the
    merged value using SharePoint Designer 2013
    For example, they have three lists as below. They want to find duplicate values in the Title column in
    Lookup3 and merge country column to a multi-value enabled column and then add item to lookup2 and set the Title to Current Item: Title.
    Lookup1:
    Title (Single line of text)
    Lookup3:
    Title (Single line of text), Country (Single line of text).
    Lookup2:
    Title (Single line of text), Test (Single line of text).
    Important actions
    "Call HTTP Web Service"
    action: In SharePoint 2013 workflows, we can call a web service using a new action introduced in SharePoint 2013 named Call HTTP Web Service. This action
    is flexible and allows you to make simple calls to a web service easily, or, if needed, you can create more complex calls using HTTP verbs as well as allowing you to add HTTP headers.
    “Build Dictionary"
    action:
    The Dictionary variable type is a new variable type in the SharePoint 2013 Workflow.
    The following are the three actions specifically designed for the Dictionary variable type: Build Dictionary, Count Items in a Dictionary and Get an Item from a Dictionary.
    The "Call HTTP Web Service" workflow action would be useless without the new "Dictionary" workflow action.
    Things to note
    The
    HTTP URI is set to https://sitename/_api/web/lists/GetByTitle('listname')/items?$orderby=Id%20desc and the HTTP method is set to “GET”. Then the list will be sort by Id in descending order.
    Use Get
    d/results(0)/Id form
    Variable: ResponseContent (Output to
    Variable: maxid) to get the Max ID.
    Use Set
    Variable: minid to Current List:ID to get the Min ID.
    Use Copy from
    Variable: destianation , starting at
    1 (Output to
    Variable: destianation) to remove the space.
    Steps to create Workflow
    Create a custom list named Lookup1.
    Create a custom list named Lookup2, add column: Test (Single line of text).
    Create a custom list named Lookup3, add column: Country (Single line of text).
    Create a workflow associated to Lookup3.
    Add a new "Build Dictionary" action
    to define the http request header:
    Add a Call HTTP Web Serviceaction, click on
    this and paste your http request.
    To associate the
    RequestHeader variable, select the Call action property,
    set the
    RequestHeaders property to
    RequestHeader:
    In the Call action, click on
    response and associate the response to a new
    variable: ResponseContent (of type Dictionary).
    After the Call action add Get item from Dictionary action to get the Max ID.
    Add Set Workflow Variable action to get the Min ID.
    Add Loop Shape (Loop with Condition) to get all the duplicate titles and integrate them to a string.
    Create item in Lookup2.
    The final Stage should look like this:
    Start the workflow automatically when an item is created.
    Add item to Lookup3, then workflow will be started automatically and create item to lookup2.
    See the below in workflow History List:
    References
    SharePoint Designer 2013 - Extracting values from a multi-value enabled lookup column into a dictionary as separate items:
    http://social.technet.microsoft.com/Forums/en-US/97d34468-1b53-4741-88b0-958472f8ca9a/sharepoint-designer-2013-extracting-values-from-a-multivalue-enabled-lookup-column-into-a
    Workflow actions quick reference (SharePoint 2013 Workflow platform):
    http://msdn.microsoft.com/en-us/library/jj164026.aspx
    Understanding Dictionary actions in SharePoint Designer 2013:
    http://msdn.microsoft.com/en-us/library/office/jj554504.aspx
    Working with Web Services in SharePoint 2013 Workflows using SharePoint Designer 2013:
    http://msdn.microsoft.com/en-us/library/office/dn567558.aspx
    Calling the SharePoint 2013 Rest API from a SharePoint Designer Workflow:
    http://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/

    GREAT info, but it may be helpful to note that when replacing a portion of the variable "Countries" with a whitespace character, you may cause the workflow to fail in a few specific cases (certain lookup fields will not accept this and will automatically
    cancel).  I only found this out when recreating your workflow on a similar, but much more complex list set.  
    To resolve this issue, I used another utility action (Extract Substring from Index of List) to clear out the whitespace.  I configured it as "Copy from
    Variable: Countries, starting at
    1 (Output to Variable: Countries), which takes care of this issue in those few cases.
    Otherwise, WOW!  AWESOME JOB!  Thanks!  :)

  • How to extract data from xml and insert into Oracle table

    Hi,
    I have a large xml file. which will have hundreds of the following transaction tags having column names and there values.
    There is a table one of the schema with coulums "actualCostRate","billRate"....etc.
    I need to extract the values of these columns and insert into the table
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuUK" chargeCode="LCOCD1" externalID="L-RESCODE_UK1-PROJ_UK_CNT_GBP-37289-8" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-12" transactionType="L" units="11" taskID="5017601" inputTypeCode="SALES" groupId="123" voucherNumber="ABCVDD" transactionClass="ABCD"/>
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuEU" chargeCode="LCOCD1" externalID="L-RESCODE_US1-PROJ_EU_STD2-37291-4" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-04" transactionType="L" units="4" taskID="5017601" inputTypeCode="SALES" groupId="124" voucherNumber="EEE222" transactionClass="DEFG"/>

    Re: Insert from XML to relational table
    http://www.google.ae/search?hl=ar&q=extract+data+from+xml+and+insert+into+Oracle+table+&btnG=%D8%A8%D8%AD%D8%AB+Google&meta=

  • Extract values from a long text

    Hi, I need help in extracting value from a long text
    Sample data:
    A_BOARD_MEETING_600
    I need to extract MEETING from the text.
    I tried to use CHARINDEX and SUBSTRING but it's not returning the text I wanted.  I hope you can help me.
    select SUBSTRING(ID, CHARINDEX('_', ID,1+CHARINDEX('_', ID))+1, CHARINDEX('_', ID, 1+CHARINDEX('_', ID, 1+CHARINDEX('_', ID,1)))-1 ) from table
    Using the query above it's returning MEETING_600.

    Hi, thanks!  But would like to ask how can this be converted where it can get the column ID in a table, I'm still learning SQL.
    Select Parsename(Replace(YOURCOLUMNNAME,'_','.'),2)From your tablename

  • Retrieving multiple values from one column in SELECT statement

    Hi,
    I have a slight dilemma in that I'm trying to pull down all the values from a column from a select statement that includes some JOINS in it.
    If I run the query at the SQL Plus prompt, it pulls back all the values/rows.
    When I run the select (and prepared ) statement in my JSP, it only pulls back one of the 4 values I'm trying to retrieve.
    e.g.
    at the DB level :
    SELECT role_name, CC_ID FROM votetbl a
    INNER JOIN APPROVERS b ON
    a.BUSVP = b.BUSVP AND
    a.BRANCH = b.BRANCH
    WHERE CC_ID = 1688this will return:
    ROLE_NAME CC_ID
    ops 1688
    ops 1688
    comply 1688
    legal 1688
    comply 1688
    When run in my JSP, like so:
    String primID3a = request.getParameter("primID");
    Statement stmtovoter = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
    String prepvotSQL = "SELECT role_name, CC_ID FROM votetbl a INNER JOIN APPROVERS b ON a.BUSVP = b.BUSVP AND " +
                         "a.BRANCH = b.BRANCH WHERE CC_ID = ?";
    PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
    prepvotstmt.setString(1, primID3a);
    ResultSet rest3 = prepvotstmt.executeQuery();
    rest3.next();
    String votecat = rest3.getString(1);
    out.println("Vote category: "+votecat);I only get ops returned.
    Do I need to run an enumerator? Or reqest.getParameterValues or use a while statement around the results set?
    Any feedback and direction here is welcomed!
    Thanks!

    Actually, I tried looping and still only get 1, but returned several times.
    i.e.
    PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
    prepvotstmt.setString(1, primID3a);
    ResultSet rest3 = prepvotstmt.executeQuery();
    rest3.next();
    String votecat = rest3.getString(1);
    while (rest3.next()) {
    out.print("category roles "+votecat);
    }then I get returned the following:
    admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admin
    like so.
    Where as at the DB level I get
    ROLE_NAME CC_ID
    admin 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    risk 1688
    comply 1688
    legal 1688
    legal 1688
    ops 1688
    comply 1688
    Maybe the while should go around the getString(1) designation? But I was thinking I'd tried that and gotten invalid cursor error
    Something is definitely amiss, between the prepared statement in the servlet and the SELECT statement at the DB level.
    I can totally hardcode the statement in the servlet or JSP and it will return one value potentially several times, but only one.
    Other times, it will not return a value at all, even though one resides in the db.
    Yet go to the DB/SQL Plus prompt and it returns perfectly. I can simply copy and paste the SELECT statement from the out.print line I made and it works like a champ in SQL Plus. Any ideas why the same exact thing cannot return the proper values within the servlet/JSP?
    Yeeeeeeesh!!! : (
    Message was edited by:
    bpropes20

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Get millisecond values from timestamp column in v$logmnr_contents

    Hello
    How do we get millisecond values from timestamp column in v$logmnr_contents.
    I tried with following query.
    select scn,To_Char(timestamp,'DD-MON-YYYY HH24:MI:SS:FF') from v$logmnr_contents WHERE OPERATION NOT IN('START') and username ='SCOTT' and sql_redo is not null and (seg_owner is null or seg_owner not in('SYS'));
    it says ORA-01821: date format not recognized. I want to find the relation of scn with timestamp. In forums i found, scn is derived from timestamp value. I dont know its correct or not.
    if i query with out FF in time format i get like
    scn timestamp
    808743 27-NOV-2007 00:12:53
    808743 27-NOV-2007 00:12:53
    808743 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    if scn is derived from timestamp with milliseconds, each scn should be different right?More help please

    May be there's an easy way solving your problem, I did it like that:
    CREATE TABLE quota_test (test VARCHAR2(50))
    INSERT INTO quota_test
    VALUES ('update "SCOTT"."NEWTAB1" set a="34" and b="45"')
    SELECT test normal, REPLACE(SUBSTR(test,INSTR(test,'"',1),INSTR(test,'.',1)+2),'"','') changed
    FROM quota_test
    Result is :
    NORMAL
    update "SCOTT"."NEWTAB1" set a="34" and b="45"      
    CHANGED
    SCOTT.NEWTAB1
    If you didn't understand, I can explain what I wrote

  • How to get string value from xml in JSF??

    In JSF How to get string value from xml, .ini and properties file. I want to get string value from xml or text to JSF

    Just use the appropriate API's for that. There are enough API's out which can read/parse/write XML, ini and properties files. E.g. JAXP or DOM4J for xml files, INI4J for ini files and Sun's own java.util.Properties for propertiesfiles.
    JSF supports properties files as message bundle and resource bundle so that you can use them for error messages and/or localization.

Maybe you are looking for

  • Error when Display/Print my expense report,travel request and travel plan

    Hello experts, I had configurated the ADS and ESS successfully.We are using ESS and interactive form now. And we had developed some interactive form and they work fine . In page "My Trips and Expenses   " , there are 4 tabs " All My Trips","  My Trav

  • Updated OS & now Time Capsule icon isn't showing up on desktop

    Just finally upgraded to 10.5. Now my Time Capsule icon isn't showing up on my desktop. Light is green on TC and I can navigate to it through Macintosh HD folder, then shared devices. I just used it as an additional external hard drive at this point.

  • 2 spool getting generated after F110 is executed

    Hi All, I am creating an vendor invoice using FB60 Then i use payment run - F110 to issue the checks Here i am getting 2 spool created each time, First spool - contains perfect data - with check number date invoice number etc.... Second spool - conta

  • Print Report Direct from current PC

    Hi I want to print pre printed reports direct to dot matrix Printer without Concurrent Manager in requested PC ( Print from PC not from Server ) . So , can i do that or not ? Thanks, Mohamed Badr

  • Need automated/hands-off deployment for VO extension

    Hello, I have created a VO extension. I only changed the query in an LOV, so I only need to promote the jpx and xml files. I have successfully promoted the xml file (moved it to the custom directory) and imported the JPX file with JPX importer. Now w