XMLTYPE extract some nodes

Hello
< book >
< book >
< id > 12 / < ID >
Oracle < name > < / name >
< / book >
< book >
< id > 15 / < ID >
< name > net < / name >
< / book >
< / books >

Please how can I retrieve the node containing the oracle book without the order of the element, in 10 g and 11 g

I mean that the result should be

< book >
< id > 12 / < ID >
Oracle < name > < / name >
< / book >

Thanks in advance

How about using the EXTRACT with following XPath function? :
book/books / [name = 'oracle']

The whole sample test case:
------------------------------------------------------------
CREATE TABLE testtab)
ID NUMBER PRIMARY KEY,
XML XMLTYPE
);
INSERT INTO testtab VALUES (1, XMLTYPE ('))

12
Oracle


15
NET

'));
COMMIT;

SELECT EXTRACT (xml, '/ books/book [name = "oracle"]') FROM testtab;
------------------------------------------------------------

Tags: Oracle Development

Similar Questions

  • How can I extract some pages from my document and save it as another file?

    How can I extract some pages from my document and save it as another file?

    You will need Adobe Acrobat to do that, not Adobe Reader.

  • Extract all nodes and filter them based on the WHERE clause

    <?xml version="1.0" encoding="UTF-8"?>
    <report_repository_summary>
       <sql sql_id="gyn915ynqjspa" sql_exec_start="08/19/2015 22:23:02" sql_exec_id="16777217">
          <status>DONE</status>
          <sql_text>BEGIN DBMS_STATS.GATHER_FIXED_OBJECTS_STATS; END;</sql_text>
          <first_refresh_time>08/19/2015 22:23:10</first_refresh_time>
          <last_refresh_time>08/19/2015 22:24:52</last_refresh_time>
          <refresh_count>54</refresh_count>
          <inst_id>1</inst_id>
          <session_id>26</session_id>
          <session_serial>20363</session_serial>
          <user_id>0</user_id>
          <user>SYS</user>
          <con_id>3</con_id>
          <con_name>PDB01_1</con_name>
          <module>sqlplus@lab (TNS V1-V3)</module>
          <service>1_1.up.com</service>
          <program>sqlplus@lab (TNS V1-V3)</program>
          <plan_hash>0</plan_hash>
          <is_cross_instance>N</is_cross_instance>
          <stats type="monitor">
             <stat name="duration">110</stat>
             <stat name="elapsed_time">109822091</stat>
             <stat name="cpu_time">78295097</stat>
             <stat name="user_io_wait_time">1388002</stat>
             <stat name="application_wait_time">1228</stat>
             <stat name="concurrency_wait_time">9175702</stat>
             <stat name="cluster_wait_time">41691</stat>
             <stat name="plsql_exec_time">39369731</stat>
             <stat name="other_wait_time">20920371</stat>
             <stat name="buffer_gets">616087</stat>
             <stat name="read_reqs">837</stat>
             <stat name="read_bytes">22998016</stat>
          </stats>
       </sql>
    </report_repository_summary>
    
    
    

    With above document XML stored as varchar2 (4000) in 12.1.0.2.0, how can I retrieve and display the relevant information(sql_id,session_id,plan_hash,duration,read_bytes) based on the place where condition to filter on any node. For example.

    select * from (
    SELECT EXTRACT (xmltype.createxml (a.report_summary), '//stats/stat[2]/text()').getstringval () AS elap_time from dba_hist_reports a WHERE component_name = 'sqlmonitor'
    )
    where elap_time > 100000000
    /
    
    
    

    Here, I try to get sql_id, sql_exec_id, duration and other information stored in the xml document by applying the where on elapsed_time condition. But to do this, I must write the part EXTRACT for all nodes in the inline view which seems like very bad way of writing of XML query. Is there an easy way to get all the information of nodes so that I can freely apply node whatever, I want in the WHERE condition to filter the records? No better way to write the code then the code below?

    select     REPORT_ID,
               EXTRACT (xmltype(a.report_summary), '//sql/@sql_id')                                    "sql_id",
               EXTRACT (xmltype(a.report_summary), '//sql/@sql_exec_id')                               "sql_exec_id",
               EXTRACT (xmltype(a.report_summary), '//sql/@sql_id')                                    "sql_exec_start",
               EXTRACT (xmltype(a.report_summary), '//status/text()')                                  "status",
               EXTRACT (xmltype(a.report_summary), '//sql_text/text()')                                "sql_text",
               EXTRACT (xmltype(a.report_summary), '//first_refresh_time/text()')              "first_refresh_time",
               EXTRACT (xmltype(a.report_summary), '//last_refresh_time/text()')               "last_refresh_time",
               EXTRACT (xmltype(a.report_summary), '//refresh_count/text()')                   "refresh_count",
               EXTRACT (xmltype(a.report_summary), '//inst_id/text()')                                         "inst_id",
               EXTRACT (xmltype(a.report_summary), '//session_id/text()')                              "session_id",
               EXTRACT (xmltype(a.report_summary), '//session_serial/text()')                  "session_serial",
               EXTRACT (xmltype(a.report_summary), '//user_id/text()')                                         "user_id",
               EXTRACT (xmltype(a.report_summary), '//user/text()')                                    "user",
               EXTRACT (xmltype(a.report_summary), '//con_id/text()')                                  "con_id",
               EXTRACT (xmltype(a.report_summary), '//con_name/text()')                                "con_name",
               EXTRACT (xmltype(a.report_summary), '//module/text()')                                  "module",
               EXTRACT (xmltype(a.report_summary), '//service/text()')                                         "service",
               EXTRACT (xmltype(a.report_summary), '//program/text()')                                         "program",
               EXTRACT (xmltype(a.report_summary), '//plan_hash/text()')                               "plan_hash",
               EXTRACT (xmltype(a.report_summary), '//is_cross_instance/text()')               "is_cross_instance",
               EXTRACT (xmltype(a.report_summary), '//stat[1]/text()')                                 "duration",
               EXTRACT (xmltype(a.report_summary), '//stat[2]/text()')                                 "elapsed_time",
               EXTRACT (xmltype(a.report_summary), '//stat[3]/text()')                                 "cpu_time",
               EXTRACT (xmltype(a.report_summary), '//stat[4]/text()')                                 "user_io_wait_time",
               EXTRACT (xmltype(a.report_summary), '//stat[5]/text()')                                 "application_wait_time",
               EXTRACT (xmltype(a.report_summary), '//stat[6]/text()')                                 "concurrency_wait_time",
               EXTRACT (xmltype(a.report_summary), '//stat[7]/text()')                                 "cluster_wait_time",
               EXTRACT (xmltype(a.report_summary), '//stat[8]/text()')                                 "plsql_exec_time",
               EXTRACT (xmltype(a.report_summary), '//stat[9]/text()')                                 "other_wait_time",
               EXTRACT (xmltype(a.report_summary), '//stat[10]/text()')                                        "buffer_gets",
               EXTRACT (xmltype(a.report_summary), '//stat[11]/text()')                                        "read_reqs",
               EXTRACT (xmltype(a.report_summary), '//stat[12]/text()')                                        "read_bytes"
    from       DBA_HIST_REPORTS a
    

    Don't know why, but it pays just 1 or 0. Even in your case his statement just 0 or 1 for all X 2 columns table.

    I guess I do something wrong in declaring XPATH for X 2 table but not able to find what it is.

    It makes account 0 or 1 because path expressions are bad.

    "For example: ' @name ="duration"

    This is a Boolean expression, not a step of XPath and so gets evaluated as such, which gives 0/1 for false/true values.

    What you need, it is something like this:

    SELECT x1.*
    FROM dba_hist_reports t
       , xmltable('/report_repository_summary/sql'
           PASSING xmlparse(document t.report_summary)
           COLUMNS
             sql_id              varchar2(15) path '@sql_id'
           , sql_exec_start      varchar2(30) path '@sql_exec_start'
           , sql_exec_id         number       path '@sql_exec_id'
           , status              varchar2(10) path 'status'
           , stats_duration      number       path 'stats/stat[@name="duration"]'
           , stats_elapsed_time  number       path 'stats/stat[@name="elapsed_time"]'
           , stats_cpu_time      number       path 'stats/stat[@name="cpu_time"]'
         ) x1
    where sql_id = 'c1tb2666n5rfx'
    and sql_exec_id = 16777668
    
  • XMLType extract help function

    I have the example of XML structure below.
    It has 2 child elements of type '< ns0:ItemMetaData >', has all first under element ' < ns0:ItemId > DSLGP603 < / ns0:ItemId > ' and second element sub "< ns0:ItemId > DSLGP603NY < / ns0:ItemId >.
    But it is the only example of 2 parts in stock, there may be 10 these xml inside the chain elements.
    How can I go/loop through all these elements '< ns0:ItemMetaData > '?
    I think I need to change this part:
    extract('//*'
    But I have not managed to change.

    --
    select *
      from xmltable ('*/text()'
                     passing xmltype ('<ns0:FindItemMetaDataResponse xmlns:ns0="http://elion.ee/webservices/Sales/Dynamics">
      <ns0:ItemMetaData>
        <ns0:ItemMetaData>
          <ns0:ItemGroupId>IT.LS.VS.DSL</ns0:ItemGroupId>
          <ns0:ItemGroupName>IT lisad võrguseadmed DSL</ns0:ItemGroupName>
          <ns0:ItemId>DSLGP603</ns0:ItemId>
          <ns0:ItemName>ADSL SIP ST546</ns0:ItemName>
          <ns0:ItemType>Item</ns0:ItemType>
          <ns0:MacAddressMandatory>No</ns0:MacAddressMandatory>
          <ns0:SalesUnit>tk</ns0:SalesUnit>
          <ns0:SerialNumMandatory>No</ns0:SerialNumMandatory>
          <ns0:TaxValue>20.00</ns0:TaxValue>
        </ns0:ItemMetaData>
        <ns0:ItemMetaData>
          <ns0:CurrencyCode>EUR</ns0:CurrencyCode>
          <ns0:ItemGroupId>KL.PS.HGW</ns0:ItemGroupId>
          <ns0:ItemGroupName>Ruuterid</ns0:ItemGroupName>
          <ns0:ItemId>DSLGP603NY</ns0:ItemId>
          <ns0:ItemName>ADSL stardikomplekt Thomson ST546 stardi</ns0:ItemName>
          <ns0:ItemType>Item</ns0:ItemType>
          <ns0:MacAddressMandatory>No</ns0:MacAddressMandatory>
          <ns0:PriceWithoutVAT>12.78</ns0:PriceWithoutVAT>
          <ns0:PriceWithVAT>15.34</ns0:PriceWithVAT>
          <ns0:SalesUnit>tk</ns0:SalesUnit>
          <ns0:SerialNumMandatory>Yes</ns0:SerialNumMandatory>
          <ns0:TaxValue>20.00</ns0:TaxValue>
        </ns0:ItemMetaData>
      </ns0:ItemMetaData>
    </ns0:FindItemMetaDataResponse>').extract('//*', 'xmlns="' || 'http://elion.ee/webservices/Sales/Dynamics' || '"')
                    )
    IT.LS.VS.DSL
    IT lisad võrguseadmed DSL
    DSLGP603
    ADSL SIP ST546
    Item
    No
    tk
    No
    20.00
    EUR
    KL.PS.HGW
    Ruuterid
    DSLGP603NY
    ADSL stardikomplekt Thomson ST546 stardi
    Item
    No
    12.78
    15.34
    tk
    Yes
    20.00
    select * from v$version;
    
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    "CORE     11.2.0.3.0     Production"
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production

    Should I then run the function "extract()" for each element node "" ItemMetaData"" sub I guess?

    You can add other columns as you wish:

    SQL> with sample_data (doc) as (
      2    select xmlparse(document
      3    '
      4    
      5      
      6        IT.LS.VS.DSL
      7        IT lisad võrguseadmed DSL
      8        DSLGP603
      9        ADSL SIP ST546
     10        Item
     11        No
     12        tk
     13        No
     14        20.00
     15      
     16      
     17        EUR
     18        KL.PS.HGW
     19        Ruuterid
     20        DSLGP603NY
     21        ADSL stardikomplekt Thomson ST546 stardi
     22        Item
     23        No
     24        12.78
     25        15.34
     26        tk
     27        Yes
     28        20.00
     29      
     30    
     31  ')
     32    from dual
     33  )
     34  select x.*
     35  from sample_data t
     36     , xmltable (
     37         xmlnamespaces(default 'http://elion.ee/webservices/Sales/Dynamics')
     38       , '/FindItemMetaDataResponse/ItemMetaData/ItemMetaData'
     39         passing t.doc
     40         columns item_id   varchar2(30) path 'ItemId'
     41               , item_name varchar2(80) path 'ItemName'
     42       ) x
     43  ;
    
    ITEM_ID                        ITEM_NAME
    ------------------------------ --------------------------------------------------------------------------------
    DSLGP603                       ADSL SIP ST546
    DSLGP603NY                     ADSL stardikomplekt Thomson ST546 stardi
     
    
  • How to extract the node where the value of the node is the max in all of the XML document?

    Hello

    I have a transaction that refers to an xmltype in iRecruitment, containing multiple versions of the same node as follows:

    (only for the example data)



    {noformat} & lt; Transaction & gt;


    & lt; data & gt;


    & lt; ObjectVersionNumber & gt; 1 & lt; / object_version_number & gt;


    & lt; EO & gt;


    & lt; Attribute1 & gt; A & lt; / Attribute1 & gt;


    & lt; Attribut2 & gt; B & lt; / attribut2 & gt;


    & lt; /EO & gt;


    & lt; / data & gt;


    & lt; data & gt;


    & lt; ObjectVersionNumber & gt; 2 & lt; / object_version_number & gt;


    & lt; EO & gt;


    & lt; Attribute1 & gt; A & lt; / Attribute1 & gt;


    & lt; Attribut2 & gt; C & lt; / attribut2 & gt;


    & lt; /EO & gt;


    & lt; / data & gt;


    & lt; data & gt;


    & lt; ObjectVersionNumber & gt; X & lt; / object_version_number & gt;


    & lt; EO & gt;


    & lt; Attribute1 & gt;? & lt; / Attribute1 & gt;


    & lt; Attribut2 & gt;? & lt; / attribut2 & gt;


    & lt; /EO & gt;


    & lt; / data & gt;


    & lt; / Transaction & gt; {noformat}

    I can extract a value for FULL-TIME 1 or 2, is not a problem.
    However, how can I go on the selection of a value of an attribute below FULL-TIME X, where X is the maximum value of FULL-TIME in any node in the XML document?

    I tried to the last node corresponding to my way, but it is not always the case that the FULL-TIME max will correspond to this scenario.

    Any help would be greatly appreciated!

    Thank you very much, Pete

    Published by: Pete Mahon on February 24, 2009 12:11

    Here's a way

    SQL> set long 100000
    SQL> with XML as (
      2  select XMLTYPE(
      3  '
      4  
      5     
      6             1
      7             
      8                     A
      9                     B
     10             
     11     
     12     
     13             2
     14             
     15                     A
     16                     C
     17             
     18     
     19     
     20             3
     21             
     22                     ?
     23                     ?
     24             
     25     
     26  ') OBJECT_VALUE
     27    from dual
     28  )
     29  select DATA, OVN
     30    from XML,
     31         XMLTable
     32         (
     33           '/Transaction/data'
     34           passing OBJECT_VALUE
     35           columns
     36           DATA XMLType path '.',
     37           OVN  number  path 'ObjectVersionNumber'
     38         )
     39   where OVN = ( select MAX(OVN)
     40                   from XML,
     41                        XMLTable
     42                        (
     43                          '/Transaction/data'
     44                          passing OBJECT_VALUE
     45                          columns
     46                          OVN  number  path 'ObjectVersionNumber'
     47                        )
     48               )
     49
    SQL> /
    
    DATA
    --------------------------------------------------------------------------------
           OVN
    ----------
    3?
    ?
             3
    
    SQL>
    
  • XMLType.extract changes data?

    declare

    l_xml xmltype.

    l_xml2 xmltype.

    Start

    l_xml: = xmltype.createxml (xmlData = > bfilename ('XMLDIR2', 'demo.xml'),)

    CSID = > 0,

    schema = > null);

    l_xml2: = l_xml.extract('/UNIVERSITY/PKU/DEP/ART');

    dbms_output.put_line (l_xml. GETSTRINGVAL);

    l_xml2: = l_xml.extract('/UNIVERSITY/PKU/DEP/ART');

    dbms_output.put_line (l_xml. GETSTRINGVAL);

    end;

    the outputs are

    UNIVERSITY <>

    < PKU >

    < num DEP = "3" >

    < ART / >

    < AUTO / >

    < CHEMICAL / >

    < / DEP >

    < / ECP >

    < TSINGHUA >

    < DEP num = "2" >

    < BUILDING / >

    < AUTO / >

    < / DEP >

    < / TSINGHUA >

    < PKU >

    < num DEP = "3" >

    < ART / >

    < AUTO / >

    < CHEMICAL / >

    < / DEP >

    < / ECP >

    < TSINGHUA >

    < DEP num = "2" >

    < BUILDING / >

    < AUTO / >

    < / DEP >

    < / TSINGHUA >

    < / UNIVERSITY >

    UNIVERSITY <>

    < PKU >

    < num DEP = "3" >

    < ART / >

    < AUTO / >

    < CHEMICAL / >

    < / DEP >

    < / ECP >

    < TSINGHUA >

    < DEP num = "2" >

    < BUILDING / >

    < AUTO / >

    < / DEP >

    < / TSINGHUA >

    < PKU >

    < num DEP = "3" >

    < ART / >

    < AUTO / >

    < CHEMICAL / >

    < / DEP >

    < / ECP >

    < TSINGHUA >

    < DEP num = "2" >

    < BUILDING / >

    < AUTO / >

    < / DEP >

    < / TSINGHUA >

    < PKU >

    < num DEP = "3" >

    < ART / >

    < AUTO / >

    < CHEMICAL / >

    < / DEP >

    < / ECP >

    < TSINGHUA >

    < DEP num = "2" >

    < BUILDING / >

    < AUTO / >

    < / DEP >

    < / TSINGHUA >

    < / UNIVERSITY >

    Cat demo.xml

    UNIVERSITY <>

    < PKU >

    < num DEP = "3" >

    < ART / >

    < AUTO / >

    < CHEMICAL / >

    < / DEP >

    < / ECP >

    < TSINGHUA >

    < DEP num = "2" >

    < BUILDING / >

    < AUTO / >

    < / DEP >

    < / TSINGHUA >

    < / UNIVERSITY >

    It seems l_xml changed every time an excerpt is called, why? Thank you very much!!!

    Hello

    I have the same problem on this version:

    BANNER

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

    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    PL/SQL Release 11.2.0.1.0 - Production

    CORE 11.2.0.1.0 Production

    AMT for 64-bit Windows: Version 11.2.0.1.0 - Production

    NLSRTL Version 11.2.0.1.0 - Production

    5 selected lines.

    The problem seems to use createxml and getstringval:

    declare
    
      l_xml   xmltype;
      l_xml2  xmltype;
    
    begin
    
      l_xml  := xmltype.createxml(xmlData => bfilename('XMLDIR2', 'demo.xml'),
                                  csid    => 0,
                                  schema  => null);
    
      dbms_output.put_line('Run 1 (getstringval):');
      dbms_output.put_line(l_xml.getstringval);
      dbms_output.put_line('Run 2 (getstringval):');
      dbms_output.put_line(l_xml.getstringval);
      dbms_output.put_line('Run 3 (getstringval):');
      dbms_output.put_line(l_xml.getstringval);
    
    end;
    /
    

    Here is the result:

    Race 1 (getstringval):

    Race 2 (getstringval):

    Race 3 (getstringval):

    Replace getstringval with getclobval seems to fix the problem.

    By creating the xml as literal does not show the same problem.

    Probably a bug on this version.

    Kind regards.

    Alberto

  • XMLType extract query

    Hello:

    How to change the following query to get only the element with a given person_id? Actually, I have a CLOB containing an XML document. I thought that step 1 is to create a view, or something that casts of this column to an XMLType object, so I do that in the data of test here as well. If I do not need to do, it makes it very well.
    with base as ( -- Base XML
        select '<?xml version="1.0" encoding="UTF-8"?>
        <person_record_set>
        <person>
        <lname>Doe</lname>
        <fname>John</fname>
        <person_id>12345</person_id>
        </person>
        <person>
        <lname>Smith</lname>
        <fname>John</fname>
        <person_id>54321</person_id>
        </person>
        <person>
        <lname>Jones</lname>
        <fname>Mary</fname>
        <person_id>33333</person_id>
        </person>
        </person_record_set>' bdata
    from dual
    ),
    Q1 as ( -- We want it as an XMLType
    select xmltype(bdata) xtdata 
    from base)
    -- End of test data setup
    select '<rows>' || extract(xtdata,'//person') || '</rows>' from Q1
    Thank you

    You can use conditions on the xpath:

    with q1 as (select xmltype('
        
        
        Doe
        John
        12345
        
        
        Smith
        John
        54321
        
        
        Jones
        Mary
        33333
        
        ') xtdata from dual)
    -- End of test data setup
    select '' || extract(xtdata,'//person[person_id=12345]') || '' from Q1
    

    I don't like particularly the addition of '', though; that's what you do with this data? There are probably better ways to do this.

    Published by: Boneist on May 16, 2012 14:55

  • A parameter of xmltype extraction problem

    Hello
    I am using oracle 11g and I am trying to use an xmltype as input to an SP parameter, here's my SP:

    create or replace PROCEDURE ABC
    (FE_Param OF XMLType)
    AS
    BEGIN
    I'm IN
    (
    SELECT XMLTYPE. EXTRACT (VALUE (a),
    ' Root/FE_ID/text()').getstringval (LIKE FE_ID)
    TABLE
    (XMLSEQUENCE (FE_Param.EXTRACT
    ("/ FEData/Root")
    ) ) a )

    LOOP
    INSERT INTO table1
    VALUES (i.FE_ID);
    END LOOP;

    The XML parameter looks like this:
    <? XML version = "1.0" encoding = "utf - 8"? >
    < FEData >
    < root > < FE_ID > 900000031 < / FE_ID >
    < FE_ID > 900000032 < / FE_ID > < FE_ID > 900000050 < / FE_ID > < / root > < / FEData >

    Triple post - what's happened? :-)

    Published by: Kim Berg Hansen on August 22, 2011 16:47

  • XMLType.extract cannot display French special characters in the select statement

    Hello
    E characters (acute e) get distorted when they are retrieved from the
    XMLType column of an ordinary table.

    How can we solve correctly get the characters e (acute e)?

    We tried setting 'setenv NLS_LANG French_France.WE8ISO8859P1' and
    "setenv NLS_LANG French_France.WE8DEC" before loading the table.

    Database version:
    SQL> select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    The test sample case is as follows:
    --connect to any schema where you can store XMLType
    set long 2000;
    set pagesize 2000;
    set serveroutput on;
    --delete from test;
    drop table test;
    create table test (id number, xmldata XMLType);
    
    
    declare
    featureDescriptorXML  CLOB;
    xml_type XMLType;
    new_xml_type XMLType;
    myName varchar2(100);
    myName2 varchar2(100);
    myName3 varchar2(100);
    stmt varchar2(4000);
    begin
     featureDescriptorXML :=
     '<?xml version="1.0" encoding="UTF-8"?>' ||
     '<abc:TheFeature xmlns:' || 'de' || '="' || 'http://abc.klmno.org/fghde' || '" xmlns:abc="http://www.ghijklmn.net/abc"' ||
     ' xmlns:xyz="http://www.ghijklmn.net/xyz">' ||
     '<abc:Name>de:MyGénérique</abc:Name>' ||
     '</abc:TheFeature>';
     xml_type := xmltype(featureDescriptorXML);
     myName := xml_type.extract('/abc:TheFeature/abc:Name/text()', 'xmlns:abc="http://www.ghijklmn.net/abc"').getStringVal();
     dbms_output.put_line('abc:Name value stored in VARCHAR2 variable from XMLType variable is ' || myName);
     -- can show French chars
    
     insert into test(id, xmldata) values(20, xml_type);
    
     stmt := 'select t.xmldata.extract(''/abc:TheFeature/abc:Name/text()'', ''xmlns:abc="http://www.ghijklmn.net/abc"'').getStringVal() from test t';
     execute immediate stmt into myName2;
     dbms_output.put_line('abc:Name value stored in VARCHAR2 variable from XMLType column in 2nd version is ' || myName2);
     -- cannot show French chars
    
    
     stmt := 'select  t.xmldata from test t';
     execute immediate stmt into new_xml_type;
     myName3 := new_xml_type.extract('/abc:TheFeature/abc:Name/text()', 'xmlns:abc="http://www.ghijklmn.net/abc"').getStringVal();
     dbms_output.put_line('abc:Name value stored in VARCHAR2 variable from first XMLType column and then from XMLType variable in 3rd version is ' || myName3);
     -- cannot show French chars
    
    end;
    /
    
    select t.xmldata.extract('/abc:TheFeature/abc:Name/text()', 'xmlns:abc="http://www.ghijklmn.net/abc"').getStringVal()
    from test t;
    -- Cannot show French chars
    
    
    select t.xmldata.extract('/abc:TheFeature/abc:Name/text()', 'xmlns:abc="http://www.ghijklmn.net/abc"').getStringVal() "myname"
    from test t;
    -- Cannot show French chars
    
    
    select t.xmldata.getCLOBVal() from test t;
    -- Cannot show French chars
    
    
    select t.xmldata from test t;
    -- Can show French chars
    Output is the following with setenv NLS_LANG French_France.WE8ISO8859P1
    and NLS_DATABASE_PARAMETERS are the following:
    SQL> select * from nls_database_parameters;
    
    PARAMETER                      VALUE
    ------------------------------ ----------------------------------------
    NLS_LANGUAGE                   AMERICAN
    NLS_TERRITORY                  AMERICA
    NLS_CURRENCY                   $
    NLS_ISO_CURRENCY               AMERICA
    NLS_NUMERIC_CHARACTERS         .,
    NLS_CHARACTERSET               WE8DEC
    NLS_CALENDAR                   GREGORIAN
    NLS_DATE_FORMAT                DD-MON-RR
    NLS_DATE_LANGUAGE              AMERICAN
    NLS_SORT                       BINARY
    NLS_TIME_FORMAT                HH.MI.SSXFF AM
    
    PARAMETER                      VALUE
    ------------------------------ ----------------------------------------
    NLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY              $
    NLS_COMP                       BINARY
    NLS_LENGTH_SEMANTICS           BYTE
    NLS_NCHAR_CONV_EXCP            FALSE
    NLS_NCHAR_CHARACTERSET         AL16UTF16
    NLS_RDBMS_VERSION              11.2.0.2.0
    
    20 ligne(s) sélectionnée(s).
    Table creé.
    
    abc:Name value stored in VARCHAR2 variable from XMLType variable is
    de:MyGénérique
    abc:Name value stored in VARCHAR2 variable from XMLType column in 2nd version is
    de:MyGénérique
    abc:Name value stored in VARCHAR2 variable from first XMLType column and then
    from XMLType variable in 3rd version is de:MyGénérique
    
    Procdure PL/SQL terminée avec succès.
    
    
    T.XMLDATA.EXTRACT('/ABC:THEFEATURE/ABC:NAME/TEXT()','XMLNS:ABC="HTTP://WWW.GHIJK
    --------------------------------------------------------------------------------
    de:MyGénérique
    
    
    myname
    --------------------------------------------------------------------------------
    de:MyGénérique
    
    
    T.XMLDATA.GETCLOBVAL()
    --------------------------------------------------------------------------------
    <?xml version="1.0" encoding="DEC-MCS"?>
    <abc:TheFeature xmlns:de="http://abc.klmno.org/fghde" xmlns:abc="http://www.ghij
    klmn.net/abc" xmlns:xyz="http://www.ghijklmn.net/xyz">
      <abc:Name>de:MyGénérique</abc:Name>
    </abc:TheFeature>
    
    
    
    XMLDATA
    --------------------------------------------------------------------------------
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <abc:TheFeature xmlns:de="http://abc.klmno.org/fghde" xmlns:abc="http://www.ghij
    klmn.net/abc" xmlns:xyz="http://www.ghijklmn.net/xyz">
      <abc:Name>de:MyGénérique</abc:Name>
    </abc:TheFeature>
    We also tried affecting NLS_CHARACTERSET AL32UTF8
    by CHARACTER SET of ALTER DATABASE.
    the database is closed and restarted.
    But that did not help.

    Thank you

    Ok. Wasn't sure. Thank you for that clarification.

    .. .but please make an attempt with XMLTABLE XMLQUERY, XMLCAST (or CAST) and other XML functions that support XQuery and not to use the engine of 'old '... I hope that these features will keep things as it should...

    .. .If not... create an SR with support of Oracle on this issue. Changes, if you base your SR on these 'old' operators XML/SQL and functions that are her will not be able to help, mainly due to the fact that your last version and stuff like EXTRACT / getStringVal() etc. are announced officially discouraged in this 11.2.0.2.0 version. As far as I know the t.xmldata.extract, the xml_type.extract and the other syntaxes, outlaw count of 10.1 (although I know, he appealed to java / OO people kind).

    Published by: Marco Gralike April 5, 2011 19:50

  • XMLType.extract: result of split

    Hello

    I use this function of the soap_api.sql for web services.
    FUNCTION get_return_value(p_response   IN OUT NOCOPY  t_response,
                              p_name       IN             VARCHAR2,
                              p_namespace  IN             VARCHAR2)
      RETURN VARCHAR2 AS
    -- ---------------------------------------------------------------------
    BEGIN
    
            RETURN p_response.doc.extract('//'||p_name||'/child::text()',p_namespace).getstringval();
    
    END;
    The problem is that it returns a large number of values, and they are all concatenated to the return value. Is there a way to divide all values with a separator or something?

    For example. It returns "TexasLos AngelesChicagoPhoenix" and I would like something like "Texas; Los Angeles; Chicago; Phoenix»

    I am using Oracle 11g

    Thank you

    Hello

    You can use the XMLQuery function and string-join (XPath 2.0).

    For example:

    SQL> DECLARE
      2
      3   xmldoc xmltype := xmltype(
      4  '
      5  Texas
      6  Los Angeles
      7  Chicago
      8  Phoenix
      9  '
     10  );
     11
     12   p_name      VARCHAR2(30) := 'city';
     13   p_namespace VARCHAR2(100) := 'test';
     14
     15   v_result    VARCHAR2(100);
     16
     17  BEGIN
     18
     19   select xmlcast(
     20    xmlquery(
     21     ( 'declare default element namespace "'||p_namespace||'"; (::)
     22       string-join(//'||p_name||'/child::text(),";")' )
     23     passing xmldoc
     24     returning content
     25    )
     26    as varchar2(100)
     27   ) into v_result
     28   from dual;
     29
     30   dbms_output.put_line(v_result);
     31
     32  END;
     33  /
    
    Texas;Los Angeles;Chicago;Phoenix
    
    PL/SQL procedure successfully completed
     
    

    It works well on 11.2, not sure about 11.1.

    Another way, by blocking the part extracted outside XQuery.
    Perhaps it fits better into your actual design:

    SQL> DECLARE
      2
      3   xmldoc xmltype := xmltype(
      4  '
      5  Texas
      6  Los Angeles
      7  Chicago
      8  Phoenix
      9  '
     10  );
     11
     12   p_name      VARCHAR2(30) := 'city';
     13   p_namespace VARCHAR2(100) := 'xmlns="test"';
     14
     15   v_result    VARCHAR2(100);
     16
     17  BEGIN
     18
     19   select xmlcast(
     20    xmlquery(
     21     'string-join(//text(),";")'
     22     passing extract(xmldoc, '//'||p_name, p_namespace)
     23     returning content
     24    )
     25    as varchar2(100)
     26   ) into v_result
     27   from dual;
     28
     29   dbms_output.put_line(v_result);
     30
     31  END;
     32  /
    
    Texas;Los Angeles;Chicago;Phoenix
    
    PL/SQL procedure successfully completed
     
    
  • Some nodes of property subVIs and graphics seem not to complete all actions unless I look at them.

    I have a few subVIs in use which take the server references to graphics and images and add sliders, establish the limits and the pixel values min/max value.  Sometimes a couple of sliders don't prepare you, or one of the limits will be bad, etc.  If I open the Subvi and place probes or preserve values to see what numbers are passed, everything is running and all of the sliders are defined.  I also had this problem outside a Subvi with a property node affecting 16-bit values min and max of pixels. I checked, and the same / correct are passed to all the nodes property, as are the correct references.  The Subvi always run correctly by operating later in the calling VI, only during initialization do they sometimes fail.

    Thank you

    Brendan

    So I tried to unifying the property node, but that has no effect.  It turns out be related to writing data in the chart before you set the sliders and the mini/maxi.  Even if the chart has not been set on autoscale, it seems that it is be re-scheduled somewhat when the data has been written.

    Thank you!

  • Having trouble getting Windows media player to recognize and extract some burned CD when I insert the CD, nothing comes up on the tab extract. I have licenses for all the protected songs and the same CD was ripped in the past by using media player.

    My computer has a virus and before I wiped it's own, I copied all my files to blank CD I was able to extract these CDs on my computer but they are in the WMA format and I want them in MP3 format. I changed the rip settings but when I put in the CD Ripper re - it, nothing comes tab extract. I tried to delete all the files in windows media player and my computer but media player doesn't always recognize the CD tab extract. I have restored my music files from the bin to WMA, but I really need to extract the songs in MP3 format. What can I do to get Windows to recognize and tear my CD? Any help is appreciated.

    Thank you!

    Make sure that there is no CD in the CD drive. Then, go to Options - confidentiality of WMP and click the button Clear the Caches . Restart WMP, and insert a CD you want to re - rip. Are you able to rip the CD now?

    If it still does not work, you can try to rip the CD from another user account (if necessary, create a new user account in the control panel). Afterwards, you can move the files ripped to MP3 to your own original account. Tim Baets
    http://www.BM-productions.TK

  • Is it possible to NAT some nodes, but not others?

    Basically, I want to give a public IP address to one of our nodes inside the firewall. I know I could give him a private address and NAT from the public to the private sector, but I want to give the node address and no NAT at all and keep all the benefits of a firewall. It is a PIX 501.

    Let me know if it is still possible.

    Thank you

    O

    Howdy,

    You can certainly. Use the following command to do this:

    NAT (inside) - 0 access list

    Then, create an ACL with the addresses that you do not want to be NAT'ed:

    10.1.2.0 ip access list allow 255.255.255.0 any

    Hope that help - rate pls post if it does.

    Paresh

  • How can I extract some pages and create the new document

    How to extract only certain pages of a document and create a new one with them?

    Hi honeybd744,

    You will need Acrobat to extract pages from PDF form and make a new PDF from these pages. If you do not have Acrobat, we invite you to try free for 30 days. Please visit www.adobe.com/products/acrobat.html for more information.

    Best,

    Sara

  • Disable Drag &amp; amp; Fall into the tree for some nodes

    It is very easy to enable Drag and Drop on tree control. How can I disable certain nodes to be trained? I didn't need all the nodes to be draggable.

    The trick is not to use the tree drag * properties of the control, but use the DragManager rather custom make drag and drop.

    This allows to listen to the mouse down events and to assess whether useDragManager.doDrag () to launch a Cannonball.

Maybe you are looking for

  • 64 bit Windows7/8/8.1/10 USB drivers for Palm Desktop

    Thank you people much more to Aceeca.com (Palm OS Garnet NEW manufacturers), the USB drivers for Vista, Windows 7 and 8 Win 64 bit operating systems are available.  There are many users Palm Desktop 4.x strives also to the declaration.I have synced m

  • Dual monitor problems / external

    I recently bought a netbook NB200/007 and want to use two monitors (mainly for display of pictures etc on larger screens) It came preloaded with Windows 7 starter, after having found that the Starter edition did not support dual monitor that I've upg

  • Satellite M30x - new HARD drive does not work

    Hello. I am installing a new ATA 2.5 "internal hard drive for my Toshiba M30X-166. The drive is a Seagate Momentus 5400.3 120 GB model. The laptop does not recognize the disc and no related error message appears, and in the BIOS, it shows as "HD not

  • Satellite L750-1EZ: No. WLan connection if 5-6 meters of router

    Hello world! I have a problem with my wify conecction.When I'm close to the router, the conecction wifi works perfectly, I get a full wifi indicator on windows and I have no trouble to surf the web. But when I go 5-6 meters from the router, although

  • When he tells me that the print spooler is turned off, where I'm going to turn it on?

    my printer works, now every time I try to print anything it tellsme the local print spooler service does not work, restart the spooler or restart the machine. How can I restart the spooler?