Reg: Doubt in XQuery FLWOR expression

Hello Experts,

I have a XML like this-

< root >

< Reports >

< report >

< ReportName > ABCM < / ReportName >

. . . other details...

< / report >

< report >

< ReportName > XYZZ < / ReportName >

. . . other details...

< / report >

< report >

< ReportName > ABCXO < / ReportName >

. . . other details...

< / report >

< report >

< ReportName > COMO < / ReportName >

.. .other details...

< / report >

< / Reports >

< / root >

I have try it like this.

Select x1.*

Of

test_xml,

XMLTABLE)

' for $i in Root/reports/reports

where $i / ReportName in ('ABCM', 'ABCXO')

Return $i"

in passing test_xml.dx

columns

slno for the ordinalite,

path of varchar2 (15) report_name 'NomRapport. "

sequence_number number path "SequenceNumber".

) x 1

;

My doubt is in the red part above.

I want to go get the details only for reports whose name start with 'ABC '. Even $i / ReportName as 'ABC%' will raise an error

ORA-19114: XPST0003 - error during parsing of the XQuery expression:

LPX-00801: error of XQuery syntax to "like".

2 where $i / ReportName as 'ABC% '.

-                                    ^

19114 00000 - "error during the analysis of the XQuery expression: %s.

* Cause: An error occurred during parsing of the XQuery expression.

* Action: Check the error message for possible causes.

Error on line: column 2:30

Please notify.

Thank you and best regards,

-Nordine

(on Oracle 11.2.0.3.0)

I gave you example ora: matches. It is easy to change it to use fn:starts - with:

with t as)

Select xmltype (')

ABCM

1

XYZZ

2

ABCXO

3

JULIE

4

xmlDoc ') of double

)

Select x1.*

t,.

XMLTable)

"' / Root/reports/reports [fn:starts - with (ReportName,"ABC")].

passage xmldoc

columns

slno for the ordinalite,

path of varchar2 (15) report_name 'NomRapport. "

sequence_number number path "SequenceNumber".

) x 1

/

SLNO REPORT_NAME SEQUENCE_NUMBER
---------- --------------- ---------------
1 ABCM                          1
2 ABCXO 3

SQL >

SY.

Tags: Database

Similar Questions

  • How to create the SQL filter using XQuery FLWOR

    It is possible to create such a FLWOR expression that will be pushed down to SQL uses 'IN SQL"filtering?

    Assuming that the following function declaration:

    declare function tns:filterOnLevels($levels_as_xs:double+) {...

    I would like to create FLWOR expression that will be pushed down to this SQL:
    Select * from LEVELS where level IN ($levels)

    And tns:filterOnLevels (1,2,3) should run statement with ' where level IN (1,2,3). Type SQL filtering owe be lowered to SQL, because the execution of the query without constraint could train with too many records.

    This expression is possible to do in XQuery/XQSE or perhaps other extensions of fn - bea?

    I'm working on ODSI/Workshop 10.3 and Oracle 10 g.

    ODSI uses multiple GOLD instead of IN because optimizers (1) rewrite 'IN' as several GOLD anyway. and (2) OR is more general than 'IN,' since 'IN' can handle that (a) equal; and (b) a single multiple-column, while GOLD can also manipulate inequalities and several columns.

    In your example...

    declare function tns:filterOnLevels($levels_as_xs:double*) {(: use ' *' instead of '+' here, the optimizer will appreciate :))}

    for $l in $levels
    for $LEVELS in LEVELS()
    where $LEVELS/LEVEL = $l
    return
    $LEVEL

    If you look at the generated query plan, it should contain...

    SELECT = from LEVELS including LEVEL? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =?

    http://download.Oracle.com/docs/CD/E13162_01/ODSI/docs10gr3/XQuery/sql_pushdown.html#wp1134043

    Integrator of data services (the announcement of best practices).

  • Reg: Difference between XQuery and XPath:

    Hi Experts,

    I tried google on this subject and read a few articles but found no adequate explanation or may not be able to understand.

    Of http://stackoverflow.com/questions/924551/difference-between-xpath-xquery-and-xpointer

    In general, XPath is a language used to locate accurate XML nodes in a DOM succinctly. XQuery is a superset of XPath which also provides FLWOR sytnax, which is similar to SQL. Finally, XPointer includes XPath, but also provides a simple model to address based on the post.

    It is also a good read - what is XQuery?

    Any other pointers? According to my understanding, both are used for the XMLs, like the SQL query for relational data. But if the two are similar, what is the reasoning behind the two different technologies?


    Please share your ideas in this regard.

    Kind regards

    -Nordine

    (on Oracle 11.2.0.3.0)

    Basic functions?

    http://www.w3.org/TR/XPath/#corelib

    Typing?

    http://www.w3.org/TR/xpath20/#ID-types

    "Transforming data" - you mean CFDS on XML data, right?

    More like SQL, but there is no strict equivalence.
    Given that XML is self-descriptive language, transforming one XML document into another also means the metadata change.
    This is where the concept of XML schema.

    What language do technical FLWOR come - XQuery or XPath?

    XQuery.

    For example:
    for $i in/root/point [1] / value
    where $i/@uom = 'kg '.
    Return to {data ($i)}

    applied to this XML document:

     
        123
     

     

    will return this sequence:

    123

    Here, / root/point [1] / value is an XPath expression (which is also an XQuery expression) but the construction of FLWOR is strictly XQuery.

  • Doubt on the regular Expression ^ A - Z

    Wich kind of expression can be inserted into a field with this review of the constraint?

    ALTER table RegexTests add constraint RegTst_S1Q2A
    check (REGEXP_LIKE (S1Q2A, ' ^ A - Z'));

    I tried:

    insert into RegexTests (S1Q2A) values ('123'); -error
    insert into RegexTests (S1Q2A) values ("A123"); -error
    insert into RegexTests (S1Q2A) values ("ABCD"); -error
    insert into RegexTests (S1Q2A) values ("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); -error
    insert into RegexTests (S1Q2A) values ('A'); -error
    insert into RegexTests (S1Q2A) values ('a'); -error

    Thanks to advice!
    start with the aphabitec alter table RegexTests add constraint RegTst_S1Q2A
    check (REGEXP_LIKE(S1Q2A, '^[A-Z]'));  OR [:alpha:] for all alphabetic
    SQL> create table RegexTests(S1Q2A varchar2(20));
    
    Table created.
    
    SQL> alter table RegexTests add constraint RegTst_S1Q2A
    check (REGEXP_LIKE(S1Q2A, '^A-Z'));  2
    
    Table altered.
    
    SQL> insert into RegexTests (S1Q2A) values ('A-Z1235422');
    
    1 row created.
    
    SQL> alter table RegexTests drop constraint RegTst_S1Q2A;
    
    Table altered.
    
    SQL> alter table RegexTests add constraint RegTst_S1Q2A
      2  check (REGEXP_LIKE(S1Q2A, '^[A-Z]'));
    
    Table altered.
    
    SQL> insert into RegexTests (S1Q2A) values ('A123');
    
    1 row created.
    

    Published by: Salim champion on May 16, 2009 09:12

  • Reg: Doubt dbms_scheduler

    Hi Experts,

    I have the script below-

    (a) Proc_2 uses CREATE_JOB to call proc_1. In this case, I don't see the exit for ' *' and ' =' in my console dbms_output. But, the good works of the Insert (insert only once).

    (b) if I Uncomment RUN_JOB, there are 2 INSERTS that passes for the same data, and I can see the outputs ' *' and ' =' in my console output - once printed.

    {package_x}

    PROC_1 {}

    I'm in (slider)

    loop

    dbms_output.put_line('***');

    INSERT INTO table_x values (i.some_value);

    dbms_output.put_line('===');

    end loop;

    commit;

    }

       proc_2 {}

    dbms_scheduler.create_job ('Task1', proc_1);

    -/ / dbms_scheduler.run_job ('job1');

    }

    }

    No idea why this phenomenon occurs? I haven't worked a lot with planners, but assumes that CREATE_JOB is called to step (a).

    Please notify.

    Thank you

    -Nordine

    (on Oracle 10.2.0.1.0)

    No idea why this phenomenon occurs? I haven't worked a lot with planners, but assumes that CREATE_JOB is called to step (a).

    Time to read the manual and then, isn't?

    RUN_JOB performs the work in an interactive way, by default in your current session. That's why you can see DBMS_OUTPUT buffer.

    -Running a task immediately. If use_current_session is TRUE the job is run the

    -the user's current session. If use_current_session is set FALSE labor is running the

    -background by a slave of dedicated work.

    PROCEDURE run_job)

    job_name IN VARCHAR2,

    use_current_session IN DEFAULT BOOLEANTRUE,

    event_message IN SYS. ANYDATA DEFAULT NULL);

    CREATE_JOB (assuming you activate it) will submit JOB1 to be run as a background process.

    If you call RUN_JOB immediately after, JOB1 still exists in the dictionary (assuming once again it is auto-dropable), and runs a second time.

  • Reg: Doubts on knowledge Modules

    Hi all
    Please give brief idea about knowledge modules. Please do not give links.
    KNOWLEDGE MODULES
    -------------------
    RETRO-DESIGN
    Ok.
    CKM
    IKM
    JKM
    SKM

    Thank you very much in advance,
    -Combo.

    LKM - loading
    The LKM - knowledge of loading Modules - loading (or extract data) one data to another server.
    They are named as follows:
    LKM à ()

    JKM - logging
    Installing JKM - logging of knowledge Modules - logging on a store of data in a data model.
    They are named as follows:
    JKM

    Note: Logging uses triggers and views. So, technologies that do not support these functions generally do not have an associated JKM.

    IKM - integration
    The IKM - Modules of knowledge of integration - integrate data into a staging target data server. Frequently, the staging area and space target are on the same database server. The IKM can handle the insert data options (Append) or the incremental (update), etc.
    They are named as follows:
    IKM to

    Note: The option is handled by the module often indicate more complex option taken in charge in this knowledge module. For instance, a module of incremental update (update) should also be able to handle the option append, i.e. the insertion and deletion of data in the target database...

    CKM - Check
    The CKM - knowledge Check Modules - manage data quality and cleaning, static data and data flows.
    They are named as follows:
    CKM ()

    RKM - retro-engineering
    RKM - knowledge market Module - one backwards engineering model of data stored in a particular technology. By default, the standard reverse to reverse all the information and metadata in most models. It is necessary for certain technologies (e.g. files) to use a personal setback and, therefore, an RKM. They are referred to specifically.

    SKM - Services
    SKM (Service knowledge Modules) are used to generate the code required to create data services. This code (typically Java) can be automatically compiled and deployed on a web services container.

    You can get more information about several KMs of
    http://www.Oracle.com/technology/products/Oracle-data-integrator/10.1.3/htdocs/documentation/oracledi_km_reference.PDF

    There is no escape from URL :)

  • Need help to retrieve the XML file

    Hello

    I'm new to xml query and I need help badly. I have a file xml with the following content. I need help to extract data as:

    beginTimelocalDnmeasObjLdnhdlcRxErrAborthdlcRxErrCRChdlcRxErrLackOfBufs
    2015 07-28 T 14: 45:00 + 03:00ERSGSN01MagId.SlotId.E1/T1Trunk.FractionId=2.8.6.1240010200
    2015 07-28 T 14: 45:00 + 03:00ERSGSN01MagId.SlotId.E1/T1Trunk.FractionId=2.9.3.1000
    2015 07-28 T 14: 45:00 + 03:00ERSGSN01MagId.SlotId.E1/T1Trunk.FractionId=2.9.4.1000

    and the XML data I have are:

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

    <? XML-stylesheet type = "text/xsl" href = "MeasDataCollection.xsl"? >

    " < measCollecFile xmlns =" http://www.3GPP.org/FTP/specs/archive/32_series/32.435#measCollec ">

    < fileFormatVersion = "32.435 V9.0" fileHeader vendorName = "Ericsson" >

    < fileSender / >

    < measCollec beginTime = "2015-07 - 28 T 14: 45:00 + 03:00" / >

    < / fileHeader >

    < measData >

    < managedElement localDn = "ERSGSN01" / >

    < measInfo measInfoId = ' E1/T1, hdlc' >

    < job jobId = "Meas_E1T1_all" / >

    < duration granPeriod = "PT900S" endTime = "2015-07 - 28 T 15: 00:01 + 03:00" / >

    < duration repPeriod = "PT900S" / >

    < p measType = "1" > hdlcRxErrAbort < / measType >

    < p measType = "2" > hdlcRxErrCRC < / measType >

    < p measType = "3" > hdlcRxErrLackOfBufs < / measType >

    < p measType = "4" > hdlcRxErrMaxFrameLen < / measType >

    < p measType = "5" > hdlcRxErrNonOctetAlign < / measType >

    < p measType = "6" > hdlcRxErrQueue < / measType >

    < p measType = "7" > hdlcRxOK < / measType >

    < p measType = "8" > hdlcRxOctets < / measType >

    < p measType '9' = > hdlcTxOK < / measType >

    < p measType = "10" > hdlcTxOctets < / measType >

    < measValue measObjLdn="MagId.SlotId.E1/T1Trunk.FractionId=2.8.6.1" >

    < p r = "1" > 2400 / < r >

    < p r '2' = > 1020 / < r >

    < p r = "3" >/< r > 0

    < p r = "4" >/< r > 0

    < p r = "5" > </r > 0

    < p r = "6" >/< r > 0

    < p r = "7" >/< r > 0

    < p r = "8" > 0 </r >

    < p r '9' = > 295 / < r >

    < p r = "10" > 4130 / < r >

    < / measValue >

    < measValue measObjLdn="MagId.SlotId.E1/T1Trunk.FractionId=2.9.3.1" >

    < p r = '1' >/< r > 0

    < p r = "2" >/< r > 0

    < p r = "3" >/< r > 0

    < p r = "4" >/< r > 0

    < p r = "5" > </r > 0

    < p r = "6" >/< r > 0

    < p r = "7" >/< r > 0

    < p r = "8" > 0 </r >

    < p r '9' = > 295 / < r >

    < p r = "10" > 4130 / < r >

    < / measValue >

    < measValue measObjLdn="MagId.SlotId.E1/T1Trunk.FractionId=2.9.4.1" >

    < p r = '1' >/< r > 0

    < p r = "2" >/< r > 0

    < p r = "3" >/< r > 0

    < p r = "4" >/< r > 0

    < p r = "5" > </r > 0

    < p r = "6" >/< r > 0

    < p r = "7" >/< r > 0

    < p r = "8" > 0 </r >

    < p r '9' = > 295 / < r >

    < p r = "10" > 4130 / < r >

    < / measValue >

    < / measInfo >

    < / measData >

    < fileFooter >

    < measCollec = endTime "2015-07 - 28 T 15: 00:01 + 03:00" / >

    < / fileFooter >

    < / measCollecFile >

    Help, please. I tried to select a value using the following xml query which does not lead to any output:

    WITH t AS (SELECT xmltype (bfilename('SGSN_STAT_ERICSSON', 'A20150728.1445+0300-20150728.1500+0300_Meas_E1T1_all.52'), nls_charset_id('UTF-8')) FROM dual xmlcol)

    SELECT beginTime, localDn, measObjLdn, hdlcRxErrAbort, hdlcRxErrCRC, hdlcRxErrLackOfBufs

    T, XMLTABLE

    (XMLNAMESPACES ('http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec' as 'ns1'), )

    ' / measCollecFile'

    passage xmlcol

    columns

    beginTime PATH VARCHAR2 (32) ' / measCollec/@beginTime',

    localDn PATH VARCHAR2 (32) ' / measData/managedElement@localDn',

    measObjLdn PATH VARCHAR2 (32) ' / measData/measInfo/measValue@measObjLdn',

    ["hdlcRxErrAbort PATH VARCHAR2 (32) ' / measData/measInfo/measValue/r[@p="1 ']',

    ["hdlcRxErrCRC PATH VARCHAR2 (32) ' / measData/measInfo/measValue/r[@p="2 ']',

    "[" hdlcRxErrLackOfBufs PATH VARCHAR2 (32) ' / measData/measInfo/measValue/r[@p="3 ']"

    )

    Sincere greetings

    Either way, using an XQuery FLWOR expression:

    select x.*
    from xmltable(
           xmlnamespaces(default 'http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec')
         , 'for $h in /measCollecFile
              , $v in $h/measData/measInfo/measValue
            return element row {
              $h/fileHeader/measCollec/@beginTime
            , $h/measData/managedElement/@localDn
            , $v/@measObjLdn
            , element r1 {$v/r[@p="1"]}
            , element r2 {$v/r[@p="2"]}
            , element r3 {$v/r[@p="3"]}
            }'
           passing xmltype(bfilename('TEST_DIR', 'test.xml'), nls_charset_id('AL32UTF8'))
           columns beginTime           timestamp with time zone path '@beginTime'
                 , localDn             varchar2(32)             path '@localDn'
                 , measObjLdn          varchar2(80)             path '@measObjLdn'
                 , hdlcRxErrAbort      number                   path 'r1'
                 , hdlcRxErrCRC        number                   path 'r2'
                 , hdlcRxErrLackOfBufs number                   path 'r3'
         ) x ;
    
  • Reg: XQuery/XPath expr.

    Hi Experts,

    I was trying to learn/experience the XQuery/XPath expressions and had some doubts.

    I learn here-http://www.w3schools.com/xquery/xquery_example.asp

    Configuration script:

    CREATE TABLE a (col1 XMLTYPE);

    INSERT INTO a VALUES (XMLTYPE ("<?")) XML version = "1.0" encoding ="ISO-8859-1"? >

    < library >

    < Book category = "COOKING" >

    < title lang = "fr" > < /title > Italian newspaper

    < author > Giada De Laurentiis < / author >

    < year > 2005 < / year >

    < price > 30.00 < / price >

    < / book >

    < Book category = "CHILDREN" >

    < title lang = "fr" > Harry Potter < /title >

    < author > J K Rowling < / author >

    < year > 2005 < / year >

    < price > 29.99 < / price >

    < / book >

    < Book category = "WEB" >

    < title lang = "fr" > XQuery Kick Start < /title >

    < author > James McGovern < / author >

    < author > per Bothner < / author >

    < author > Kurt Cagle < / author >

    < author > James Linn < / author >

    < author > Vaidyanathan Nagarajan < / author >

    < year > 2003 < / year >

    < price > 49.99 < / price >

    < / book >

    < Book category = "WEB" >

    < title lang = "fr" > Learning XML < /title >

    < author > Erik T. Ray < / author >

    < year > 2003 < / year >

    < price > 39.95 < / price >

    < / book >

    ((< / book > '));

    It worked:

    RANIT@XE11GR2 > > ed

    A written file afiedt.buf

    1 Select xt.colx

    2 a, XMLTable ('/ bookstore/book[price < 40]')

    3 passage a.col1

    4 columns

    5 way XMLTYPE colx '.'

    6 *) xt

    RANIT@XE11GR2 > >.

    COLX

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

    < Book category = "COOKING" >

    < title lang = "fr" > < /title > Italian newspaper

    < author > Giada De Laurentiis < / author >

    < year > 2005 < / year >

    < price > 30.00 < / price >

    < / book >

    < Book category = "CHILDREN" >

    < title lang = "fr" > Harry Potter < /title >

    < author > J K Rowling < / author >

    < year > 2005 < / year >

    < price > 29.99 < / price >

    < / book >

    < Book category = "WEB" >

    < title lang = "fr" > Learning XML < /title >

    < author > Erik T. Ray < / author >

    < year > 2003 < / year >

    < price > 39.95 < / price >

    < / book >

    Elapsed time: 00:00:00.16

    But when tried to join another filter condition, it gives me the error:

    RANIT@XE11GR2 > > ed

    A written file afiedt.buf

    1 Select xt.colx

    2 a, XMLTable ('/ bookstore/book[< 40 year AND price < 2004]')

    3 passage a.col1

    4 columns

    5 way XMLTYPE colx '.'

    6 *) xt

    RANIT@XE11GR2 > >.

    a XMLTable ('/ bookstore/book [price < 40 year AND < 2004] ")

    *

    ERROR on line 2:

    ORA-19114: XPST0003 - error during parsing of the XQuery expression:

    LPX-00801: to "AND" XQuery syntax error

    1/bookstore/book [price < 40 year AND < 2004]

    -                           ^

    Elapsed time: 00:00:00.04

    RANIT@XE11GR2 > > ed

    A written file afiedt.buf

    1 Select xt.colx

    2 a, XMLTable ('/ bookstore/book[price < year 40, < 2004]')

    3 passage a.col1

    4 columns

    5 way XMLTYPE colx '.'

    6 *) xt

    RANIT@XE11GR2 > >.

    ERROR:

    ORA-19169: FORG0006: invalid argument in «fn:boolean()» type

    no selected line

    Elapsed time: 00:00:00.20

    Could you please help me how to add multiple condition filter here?

    Thank you

    -Nordine

    (on Oracle 11.2.0.3.0)

    There "and" lowercase:

    / bookstore/book [price<40 and=""><>

    If I may ask another site to start learning: Tutorials of XQuery

    And of course, the W3C recommendation official, always useful to get information about the base language: http://www.w3.org/TR/xquery/

    For the Oracle specifics, see DB XML Dev Guide:

    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/xdb_xquery.htm

    Also, as you should know by now, this kind of questions belong to the forum DB XML or XQuery forum (for a general discussion of the language).

  • XQuery does not return results in 10.2.0.4, works on 10.2.0.5

    I have a statement Xquery which works as expected on Oracle 10.2.0.5 but returns no results on Oracle 10.2.0.4.

    What is the result of a query that is poorly written? A bug in 10.2.0.4?
    Is it possible to rewrite the query so that is done the work on 10.2.0.4?

    TestCode:
    declare
    
       l_xml xmltype;
    
       -- Select layers with TileMatrixSet EPSG:28992
       cursor c_layer(p_xml xmltype) is
          select t.*
            from xmltable(xmlnamespaces(default 'http://www.opengis.net/wmts/1.0'
                                       ,'http://www.opengis.net/ows/1.1' as "ows"
                                        ,'http://schemas.opengis.net/gml' as "gml"
                                        ,'http://www.w3.org/1999/xlink' as "xlink"
                                        ,'http://www.w3.org/2001/XMLSchema-instance' as "xsi")
                          ,'for $d in //Layer[TileMatrixSetLink/TileMatrixSet="EPSG:28992"] return $d' passing
                          p_xml columns title varchar2(100) path 'ows:Title'
                          ,format varchar2(100) path 'Format'
                          ,style xmltype path 'Style') as t;
    
    begin
    
       l_xml := xmltype.createxml('<?xml version="1.0" encoding="UTF-8"?>
    <Capabilities xmlns="http://www.opengis.net/wmts/1.0"
    xmlns:ows="http://www.opengis.net/ows/1.1"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd"
    version="1.0.0">
    <Contents>
      <Layer>
        <ows:Title>brtachtergrondkaart</ows:Title>
        <ows:Identifier>brtachtergrondkaart</ows:Identifier>
        <Style isDefault="true">
          <ows:Identifier>_null</ows:Identifier>
        </Style>
        <Format>image/png8</Format>
        <TileMatrixSetLink>      <TileMatrixSet>EPSG:28992</TileMatrixSet>
        </TileMatrixSetLink>  </Layer>
      <Layer>
        <ows:Title>top10nl</ows:Title>
        <ows:Identifier>top10nl</ows:Identifier>
        <Style isDefault="true">
          <ows:Identifier>_null</ows:Identifier>
        </Style>
        <Format>image/png8</Format>
        <TileMatrixSetLink>      <TileMatrixSet>EPSG:28992</TileMatrixSet>
        </TileMatrixSetLink>  </Layer>
      <Layer>
        <ows:Title>bgt</ows:Title>
        <ows:Identifier>bgt</ows:Identifier>
        <Style isDefault="true">
          <ows:Identifier>_null</ows:Identifier>
        </Style>
        <Format>image/png8</Format>
        <TileMatrixSetLink>      <TileMatrixSet>EPSG:28992</TileMatrixSet>
        </TileMatrixSetLink>  </Layer>
    </Contents>
    </Capabilities>');
    
       for r_layer in c_layer(l_xml)
       loop
          dbms_output.put_line(r_layer.title);
       end loop;
    end;
    10.2.0.5 strategic outcome:
    brtachtergrondkaart
    top10nl
    BGT

    It is indeed strange.

    I can reproduce on 10.2.0.4 and follows seems to remedy:

    (1) containing the list of columns in the SELECTION, instead of t.*:

       -- Select layers with TileMatrixSet EPSG:28992
       cursor c_layer(p_xml xmltype) is
          select t.title, t.format, t.style
            from xmltable(
    

    or,

    (2) with the help of a FLWOR expression extended:

    for $d in //Layer
    where $d/TileMatrixSetLink/TileMatrixSet = "EPSG:28992"
    return $d
    

    You may have already noticed, but the problem only occurs in a context of PL/SQL.
    The same query to run from SQL is OK.

  • XPath to capture nodes between two nodes

    Hi all

    I met a problem a seemingly simple challenge of mine.

    I have the following xml code.

    Basically, I would like to capture the text between the begin-end blocks

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

    < document >

    < body >

    < paragraph >

    < run >

    < fld type = 'start' / >

    < / run >

    < run >

    < text > SAMPLE < / text >

    < / run >

    < run >

    < text > < / text >

    < / run >

    < run >

    < text > FIELD < / text >

    < / run >

    < run >

    < fld type = 'end' / >

    < / run >

    < run >

    < text > TEXT UNWANTED SOME < / text >

    < / run >

    < / paragraph >

    < paragraph >

    < run >

    < fld type = 'start' / >

    < / run >

    < run >

    < text > SAMPLE < / text >

    < / run >

    < run >

    < text > < / text >

    < / run >

    < run >

    < text > Field2 < / text >

    < / run >

    < run >

    < fld type = 'end' / >

    < / run >

    < run >

    < text > TEXT UNWANTED SOME < / text >

    < / run >

    < run >

    < fld type = 'start' / >

    < / run >

    < run >

    < text > SAMPLE < / text >

    < / run >

    < run >

    < text > < / text >

    < / run >

    < run >

    < text > FIELD3 < / text >

    < / run >

    < run >

    < fld type = 'end' / >

    < / run >

    < / paragraph >

    < / body >

    < / document >

    So far, what I came up with is:

    WITH temp AS (
    SELECT 
           XMLTYPE ('<?xml version="1.0" encoding="UTF-8"?>
                      <document>
                         <body>
                            <paragraph>
                               <run>
                                  <fld type="begin" />
                               </run>
                               <run>
                                  <text>SAMPLE</text>
                               </run>
                               <run>
                                  <text> </text>
                               </run>
                               <run>
                                  <text>FIELD</text>
                               </run>
                               <run>
                                  <fld type="end" />
                               </run>
                               <run>
                                  <text>SOME UNWANTED TEXT</text>
                               </run>
                            </paragraph>
                            <paragraph>
                               <run>
                                  <fld type="begin" />
                               </run>
                               <run>
                                  <text>SAMPLE</text>
                               </run>
                               <run>
                                  <text> </text>
                               </run>
                               <run>
                                  <text>FIELD2</text>
                               </run>
                               <run>
                                  <fld type="end" />
                               </run>
                               <run>
                                  <text>SOME UNWANTED TEXT</text>
                               </run>
                               <run>
                                  <fld type="begin" />
                               </run>
                               <run>
                                  <text>SAMPLE</text>
                               </run>
                               <run>
                                  <text> </text>
                               </run>
                               <run>
                                  <text>FIELD3</text>
                               </run>
                               <run>
                                  <fld type="end" />
                               </run>
                            </paragraph>
                         </body>
                      </document>') AS xml_template
    FROM dual
    )
    SELECT x.*
      FROM temp
          ,XMLTABLE('//*/paragraph/run[fld/@type="begin"]/following-sibling::run[following-sibling::run[fld/@type="end"]]/text'
                    PASSING temp.xml_template
                    COLUMNS res varchar2(100) PATH '.'
                   )x
    

    Result:

    RES

    SAMPLE

    FIELD

    SAMPLE

    FIELD2

    SOME UNWANTED TEXT

    SAMPLE

    FIELD3

    Unfortunately what I wrote XPath is not good enough, because with regard to the text between the two blocs of start-end it still captures the unwanted text.

    My XPath knowledgege dept unfortunately not so I would appriciate annything you can help me with even an idea could get through on the edge.

    Thank you

    Steve

    Steve,

    XQuery can help in this case:

    SELECT x.*
    FROM temp
       , XMLTABLE('for $begin in /document/body/paragraph/run[fld/@type="begin"]
                   let $end := $begin/following-sibling::run[fld/@type="end"][1]
                   return $begin/following-sibling::run[. << $end]'
           PASSING temp.xml_template
           COLUMNS res varchar2(100) PATH 'text'
         ) x  ;
    

    Explanation:

    This FLWOR expression traverses all nodes 'start' in the document, finds the corresponding node of the 'end' and returns the sequence of "run" nodes follows 'begin' and above 'end '.

    If you want to concatenate all the fragments of text in a block, you can also do it directly, like this:

    for $begin in /document/body/paragraph/run[fld/@type="begin"]
    let $end := $begin/following-sibling::run[fld/@type="end"][1]
    return string-join($begin/following-sibling::run[. << $end]/text, "")
    

    She's going back 3 ranks:

    RES

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

    EXAMPLE OF A FIELD

    SAMPLE FIELD2

    SAMPLE FIELD3

  • Please help to read the XML with XMLTable

    Hi gurus,

    I'm not very familiar with XML parsing. It seems to me that it should be very easy to get the data. For some reason, I'm having a problem to get the data.

    SELECT *.
    OF e util.hlsr_online_entries,.
    XMLTABLE)
    XmlNamespaces)
       ' http://tempuri.org/ '    as "dt",
    ("urn: schemas-microsoft-com: XML-diffgram-v1" as "dg").

    "/ DataTable / dg:diffgram/DocumentElement/JrShowCustomerHeifers.
    PASSAGE XMLTYPE (e.entry_data)
    COLUMNS
    SeqNo TO the ORDINALITE,
    DocumentID NUMBER PATH "DocumentID",.
    PATH of VARCHAR2 (100) ClubName "ClubName") as test
    WHERE e.ref_id = 33422

    The query above does all the data for me. My hunts is the problem with the tab DocumentElement. I tried a different variant management.

    Please help me to resolve the application

    I have the XML document following the DotNet developer

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

    " < DataTable xmlns =" http://tempuri.org/ ">

    < xs: Schema id = "NewDataSet" xmlns = "" "xmlns: XS =" " http://www.w3.org/2001/XMLSchema " "xmlns:msdata ="urn: schemas-microsoft-com: xml-msdata" >

    < xs: element name = "NewDataSet" msdata:IsDataSet = "true" msdata:MainDataTable = "JrShowCustomerHeifers" msdata:UseCurrentLocale = "true" >

    < xs: complexType >

    < xs: Choice minOccurs = "0" maxOccurs = "unbounded" >

    < xs: element name = "JrShowCustomerHeifers" >

    < xs: complexType >

    < xs: SEQUENCE >

    < xs: element name = "DocumentID" type = "xs: int" minOccurs = "0" / >

    < xs: element name = "ClubName" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "Name" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "FirstName" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "PreferredName" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "Email" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "Exhibitor" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "AnimalName" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "RegistryNo" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "DateofBirth" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "NameofSire" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "SireRegistryNo" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "NameofDam" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "DamRegistryNo" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "Tattoo" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "SecondaryTattoo" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "UniversalIDNumber" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "Tattoo_Location" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "Secondary_Tattoo_Location" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "OracleBreedID" type = "xs: int" minOccurs = "0" / >

    < xs: element name = "JrValidationBreedName" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "ValidationDate" type = "xs: DateTime" minOccurs = "0" / >

    < xs: element name = "ValidatedBy" type = "xs: String" minOccurs = "0" / >

    < xs: element name = "ValidationComment" type = "xs: String" minOccurs = "0" / >

    < / xs: SEQUENCE >

    < / xs: complexType >

    < / xs: element >

    < / xs: Choice >

    < / xs: complexType >

    < / xs: element >

    < / xs: Schema >

    < xmlns:msdata = diffgr:diffgram "" urn: schemas-microsoft-com: xml-msdata "xmlns:diffgr =" urn: schemas-microsoft-com: XML-diffgram-v1 ">"

    < DocumentElement xmlns = "" >

    < JrShowCustomerHeifers diffgr: ID = "JrShowCustomerHeifers1" msdata:rowOrder = "0" >

    < > 18442 DocumentID < / DocumentID >

    < ClubName > Perrin FFA < / ClubName >

    Hamman < name > < / LastName >

    < FirstName > Charles < / name >

    < email > [email protected] < / email >

    < setting > hammam, Charles < / Exhibitor >

    < > 113 AnimalName < / AnimalName >

    < RegistryNo > C1026447 < / RegistryNo >

    < DateofBirth > 14/01/2013 < / DateofBirth >

    < NameofSire > 808 808 DAYS of MATCH LH < / NameofSire >

    < SireRegistryNo > C961101 < / SireRegistryNo >

    SADIE 7/7 < NameofDam > < / NameofDam >

    < DamRegistryNo > C941067 < / DamRegistryNo >

    < > 113 tattoo < / tattoo >

    < SecondaryTattoo / >

    < UniversalIDNumber > 1194F020 < / UniversalIDNumber >

    < Tattoo_Location > TATTOO - left ear < / Tattoo_Location >

    < Secondary_Tattoo_Location / >

    < OracleBreedID > 6383 < / OracleBreedID >

    Beefmaster < JrValidationBreedName > < / JrValidationBreedName >

    < ValidationDate > 2014-11-25T 08: 39:00 - 06:00 < / ValidationDate >

    < ValidatedBy > laineyb < / ValidatedBy >

    < ValidationComment / >

    < / JrShowCustomerHeifers >

    < JrShowCustomerHeifers diffgr: ID = "JrShowCustomerHeifers2" msdata:rowOrder = "1" >

    < > 18473 DocumentID < / DocumentID >

    < ClubName > Perrin FFA < / ClubName >

    Hamman < name > < / LastName >

    < FirstName > Charles < / name >

    < email > [email protected] < / email >

    < setting > hammam, Charles < / Exhibitor >

    < AnimalName > PURPLE CORALEE 349 KPH < / AnimalName >

    < RegistryNo > P43461953 < / RegistryNo >

    < DateofBirth > 04/11/2013 < / DateofBirth >

    < NameofSire > PURPLE MOXY 22 X AND < / NameofSire >

    < SireRegistryNo > P43126458 < / SireRegistryNo >

    < NameofDam > TCC CORKY 6603 < / NameofDam >

    < DamRegistryNo > P42457119 < / DamRegistryNo >

    < > 349 tattoo < / tattoo >

    < SecondaryTattoo > km/h < / SecondaryTattoo >

    < UniversalIDNumber > 1194F021 < / UniversalIDNumber >

    < Tattoo_Location > TATTOO - left ear < / Tattoo_Location >

    < Secondary_Tattoo_Location > TATTOO - right ear < / Secondary_Tattoo_Location >

    < OracleBreedID > 6389 < / OracleBreedID >

    < JrValidationBreedName > Polled Hereford < / JrValidationBreedName >

    < ValidationDate > 2014 - 12-01 T 11: 55:00 - 06:00 < / ValidationDate >

    Hannah < ValidatedBy > < / ValidatedBy >

    < ValidationComment / >

    < / JrShowCustomerHeifers >

    < JrShowCustomerHeifers diffgr: ID = "JrShowCustomerHeifers3" msdata:rowOrder = "2" >

    < > 18474 DocumentID < / DocumentID >

    < ClubName > Perrin FFA < / ClubName >

    Hamman < name > < / LastName >

    < FirstName > Charles < / name >

    < email > [email protected] < / email >

    < setting > hammam, Charles < / Exhibitor >

    < AnimalName > LANGFORDS SWEET N SOUR 4107 < / AnimalName >

    < RegistryNo > 43504761 < / RegistryNo >

    < DateofBirth > 02/03/2014 < / DateofBirth >

    < NameofSire > LH TNT 1017 < / NameofSire >

    < SireRegistryNo > 43199794 < / SireRegistryNo >

    < NameofDam > LANGFORDS LADY 2206 AND < / NameofDam >

    < DamRegistryNo > 43315143 < / DamRegistryNo >

    < > 4107 tattoo < / tattoo >

    < SecondaryTattoo / >

    < UniversalIDNumber > 1194F018 < / UniversalIDNumber >

    < Tattoo_Location > TATTOO - left ear < / Tattoo_Location >

    < Secondary_Tattoo_Location / >

    < OracleBreedID > 6398 < / OracleBreedID >

    Hereford < JrValidationBreedName > < / JrValidationBreedName >

    < ValidationDate > 2014-11-24T 14:26:00 - 06:00 < / ValidationDate >

    Validator < ValidatedBy > < / ValidatedBy >

    < ValidationComment / >

    < / JrShowCustomerHeifers >

    < JrShowCustomerHeifers diffgr: ID = "JrShowCustomerHeifers4" msdata:rowOrder = "3" >

    < > 18475 DocumentID < / DocumentID >

    < ClubName > Perrin FFA < / ClubName >

    Hamman < name > < / LastName >

    < FirstName > Charles < / name >

    < email > [email protected] < / email >

    < setting > hammam, Charles < / Exhibitor >

    < AnimalName > PURPLE CCC 19A LYDIA < / AnimalName >

    < RegistryNo > P43406978 < / RegistryNo >

    < DateofBirth > 05/02/2013 < / DateofBirth >

    < NameofSire > PURPLE MB WOMANIZER 14UET < / NameofSire >

    < SireRegistryNo > P42945146 < / SireRegistryNo >

    < NameofDam > PURPLE CMCC NASTIA 9U < / NameofDam >

    < DamRegistryNo > P42927201 < / DamRegistryNo >

    < > 19A tattoo < / tattoo >

    < SecondaryTattoo / >

    < UniversalIDNumber > 1194F017 < / UniversalIDNumber >

    < Tattoo_Location > TATTOO - left ear < / Tattoo_Location >

    < Secondary_Tattoo_Location / >

    < OracleBreedID > 6389 < / OracleBreedID >

    < JrValidationBreedName > Polled Hereford < / JrValidationBreedName >

    < ValidationDate > 2014 - 12-01 T 11: 55:00 - 06:00 < / ValidationDate >

    Hannah < ValidatedBy > < / ValidatedBy >

    < ValidationComment / >

    < / JrShowCustomerHeifers >

    < JrShowCustomerHeifers diffgr: ID = "JrShowCustomerHeifers5" msdata:rowOrder = "4" >

    < > 18477 DocumentID < / DocumentID >

    < ClubName > Perrin FFA < / ClubName >

    Hamman < name > < / LastName >

    < FirstName > Charles < / name >

    < email > [email protected] < / email >

    < setting > hammam, Charles < / Exhibitor >

    < AnimalName > PURPLE SGW EDEN 12 b < / AnimalName >

    < RegistryNo > P43521932 < / RegistryNo >

    < DateofBirth > 02/04/2014 < / DateofBirth >

    < NameofSire > first TIME's a WASTINe 0124 < / NameofSire >

    < SireRegistryNo > 43123163 < / SireRegistryNo >

    < NameofDam > PURPLE SM WONDER WOMAN 160Y < / NameofDam >

    < DamRegistryNo > P43235169 < / DamRegistryNo >

    < tattoo > 12 b < / tattoo >

    < SecondaryTattoo > 12 b < / SecondaryTattoo >

    < UniversalIDNumber > 1194F015 < / UniversalIDNumber >

    < Tattoo_Location > TATTOO - left ear < / Tattoo_Location >

    < Secondary_Tattoo_Location > TATTOO - right ear < / Secondary_Tattoo_Location >

    < OracleBreedID > 6389 < / OracleBreedID >

    < JrValidationBreedName > Polled Hereford < / JrValidationBreedName >

    < ValidationDate > 2014 - 12-01 T 11: 56:00 - 06:00 < / ValidationDate >

    Hannah < ValidatedBy > < / ValidatedBy >

    < ValidationComment / >

    < / JrShowCustomerHeifers >

    < / DocumentElement >

    < / diffgr:diffgram >

    < / DataTable >

    user12021633 wrote:

    Regarding your suggestion, I've never used the syntax of FLWOR. I'll try to implement if I can make it work.

    "FLWOR is the abbreviation of ' for Let's where Order by Return" and refers to the full form of an XQuery query expression.

    Do you think it would be faster than the way I have the values?

    You have used a FLWOR expression (the 'for' + 'return' part of it) in this post: Re: Please help to read the XML with XMLTable

    And I have already said: do not use in this case.

    Faster or slower isn't the point. Oracle will evaluate the expression in the same way.

    But from a maintenance point of view, it's obviously much easier to use a simple XPath expression like this:

    /DT:GetJrShowCustomerHeifersResponse / dt:GetJrShowCustomerHeifersResult / dg:diffgram/DocumentElement/JrShowCustomerHeifers

  • How to create indexes on the ordered collection of XMLTYPE table?

    I use Oracle 11.2.0.2.

    Basically, my XML documents have a 3-level hierarchy:

    event

    + - action [1: n]

    + - param [1: n]

    I try to create indexes on the tables of the orderly collection, but cannot get the right syntax...

    I created a table with an XMLType object-relational column:

    CREATE TABLE T_C_RMP_MNTRNG_XML_FULL_IL4 (
      MESSAGE_ID NUMBER(22,0) NOT NULL ENABLE,
      XML_EVAL_ID NUMBER(22,0),
      VIN7 VARCHAR2(7 BYTE),
      FLEET_ID VARCHAR2(50 BYTE),
      CSC_SW_VERSION VARCHAR2(100 BYTE),
      RECEIVED DATE,
      XML_CONTENT SYS.XMLTYPE ,
      DWH_LM_TS_UTC DATE NOT NULL ENABLE,
      CONSTRAINT PK_C_RMP_MNTRNG_XML_FULL_IL4 PRIMARY KEY (MESSAGE_ID)
    ) NOLOGGING TABLESPACE CATALOG
    VARRAY "XML_CONTENT"."XMLDATA"."action" STORE AS TABLE "T_OR_MON_ACTION" (
      NOLOGGING TABLESPACE "CATALOG"
      VARRAY "param" STORE AS TABLE "T_OR_MON_ACTION_PARAM" (
      NOLOGGING TABLESPACE "CATALOG"
      ) RETURN AS LOCATOR
    ) RETURN AS LOCATOR
    XMLTYPE XML_CONTENT STORE AS OBJECT RELATIONAL XMLSCHEMA "http://mydomain.com/cs.xsd" ELEMENT "monitoring";
    
    
    
    
    

    I execute the SELECT statement:

    SELECT EVENT_ID, ACTION_SUB_ID, MESSAGE_ID, ACTION_TYPE, UNIXTS_TO_DATE(ACTION_TIMESTAMP) ACTION_TIMESTAMP
    FROM T_C_RMP_MNTRNG_XML_FULL_IL4, 
    XMLTABLE( 
      'for $i1 in /monitoring , 
      $i2 in $i1/action            
      return element r {              
      $i1/eventId,              
      $i2            
      }' 
      PASSING XML_CONTENT COLUMNS 
      EVENT_ID VARCHAR(40) PATH 'eventId', 
      ACTION_SUB_ID INTEGER PATH 'action/actionSubId', 
      ACTION_TYPE VARCHAR2(100) PATH 'action/type', 
      ACTION_TIMESTAMP NUMBER(13,0) PATH 'action/time' 
    ) T2 
    WHERE ( 
      EVENT_ID IS NOT NULL AND ACTION_SUB_ID IS NOT NULL 
    )
    
    
    
    
    

    The plan of the explain command looks like this (sorry, don't know how to get it formatted any 'eye-team'):

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

    | ID | Operation | Name                        | Lines | Bytes | TempSpc | Cost (% CPU). Time |

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

    |   0 | SELECT STATEMENT |                             |  1609K |  6316M |       |  6110K (1) | 20:22:11 |

    |*  1 |  HASH JOIN |                             |  1609K |  6316M |   111 M |  6110K (1) | 20:22:11 |

    |   2.   TABLE ACCESS FULL | T_C_RMP_MNTRNG_XML_FULL_IL4 |   582K |   104 M |       |  5241 (1) | 00:01:03 |

    |*  3 |   TABLE ACCESS FULL | T_OR_MON_ACTION |    32 M |   117G |       |   105K (2) | 00:21:08 |

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

    Information of predicates (identified by the operation identity card):

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

    1 - access ("NESTED_TABLE_ID"= "T_C_RMP_MNTRNG_XML_FULL_IL4"." ("SYS_NC0001300014$")

    filter (CAST (SYS_XQ_UPKXML2SQL (SYS_XQEXVAL (SYS_XQEXTRACT ((SYS_XMLGEN ("T_C_RMP_MNTRN XMLCONCAT

    G_XML_FULL_IL4 ". "" $ SYS_NC00017 ", NULL, SYS_XMLCONV ("T_C_RMP_MNTRNG_XML_FULL_IL4". "SYS_NC00012$", 0.32,

    (('EC1EEF23FD023A27E04032A06D930A8D', 3, 3783, 1)), SYS_MAKEXML ('EC1EEF23FD023A27E04032A06D930A8D', 3780,

    'T_C_RMP_MNTRNG_XML_FULL_IL4 '. "' SYS_NC00008$ ', 'SYS_ALIAS_0 '. ((("' SYS_NC_ROWINFO$ ')),'/ ID ', NULL), 0,.

    0,20971520,0), 50.1, 2) AS VARCHAR (40)) IS NOT NULL)

    3 filter (CAST (TO_NUMBER (TO_CHAR ("SYS_ALIAS_0". "actionSubId")) AS INTEGER) IS NOT NULL) "

    Note

    -----

    -dynamic sample used for this survey (level = 2)

    -Construction detected no optimized XML (activate XMLOptimizationCheck for more information)

    The XML schema looks like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:oraxdb="http://xmlns.oracle.com/xdb" oraxdb:storeVarrayAsTable="true" oraxdb:flags="2105639" oraxdb:schemaURL="http://mydomain.com/cs.xsd" oraxdb:schemaOwner="MYUSER" oraxdb:numProps="23">
      <xs:element name="monitoring" oraxdb:propNumber="3785" oraxdb:global="true" oraxdb:SQLName="monitoring" oraxdb:SQLType="monitoring755_T" oraxdb:SQLSchema="MYUSER" oraxdb:memType="258" oraxdb:defaultTable="monitoring757_TAB" oraxdb:defaultTableSchema="MYUSER">
        <xs:complexType oraxdb:SQLType="monitoring755_T" oraxdb:SQLSchema="MYUSER">
          <xs:sequence>
            <xs:element maxOccurs="unbounded" ref="action" oraxdb:propNumber="3780" oraxdb:global="false" oraxdb:SQLName="action" oraxdb:SQLType="action752_T" oraxdb:SQLSchema="MYUSER" oraxdb:memType="258" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false" oraxdb:SQLCollType="action756_COLL" oraxdb:SQLCollSchema="MYUSER"/>
            <xs:element ref="reservationType" oraxdb:propNumber="3781" oraxdb:global="false" oraxdb:SQLName="reservationType" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
            <xs:element ref="softwareVersion" oraxdb:propNumber="3782" oraxdb:global="false" oraxdb:SQLName="softwareVersion" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
            <xs:element ref="eventId" oraxdb:propNumber="3783" oraxdb:global="false" oraxdb:SQLName="eventId" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
            <xs:element ref="vin" oraxdb:propNumber="3784" oraxdb:global="false" oraxdb:SQLName="vin" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="action" oraxdb:propNumber="3790" oraxdb:global="true" oraxdb:SQLName="action" oraxdb:SQLType="action752_T" oraxdb:SQLSchema="MYUSER" oraxdb:memType="258" oraxdb:defaultTable="action754_TAB" oraxdb:defaultTableSchema="MYUSER">
        <xs:complexType oraxdb:SQLType="action752_T" oraxdb:SQLSchema="MYUSER">
          <xs:sequence>
            <xs:element ref="type" oraxdb:propNumber="3786" oraxdb:global="false" oraxdb:SQLName="type" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
            <xs:element maxOccurs="unbounded" ref="param" oraxdb:propNumber="3787" oraxdb:global="false" oraxdb:SQLName="param" oraxdb:SQLType="param749_T" oraxdb:SQLSchema="MYUSER" oraxdb:memType="258" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false" oraxdb:SQLCollType="param753_COLL" oraxdb:SQLCollSchema="MYUSER"/>
            <xs:element ref="actionSubId" oraxdb:propNumber="3788" oraxdb:global="false" oraxdb:SQLName="actionSubId" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
            <xs:element ref="time" oraxdb:propNumber="3789" oraxdb:global="false" oraxdb:SQLName="time" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="type" type="xs:string" oraxdb:propNumber="3791" oraxdb:global="true" oraxdb:SQLName="type" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:defaultTable="type751_TAB" oraxdb:defaultTableSchema="MYUSER"/>
      <xs:element name="param" oraxdb:propNumber="3794" oraxdb:global="true" oraxdb:SQLName="param" oraxdb:SQLType="param749_T" oraxdb:SQLSchema="MYUSER" oraxdb:memType="258" oraxdb:defaultTable="param750_TAB" oraxdb:defaultTableSchema="MYUSER">
        <xs:complexType oraxdb:SQLType="param749_T" oraxdb:SQLSchema="MYUSER">
          <xs:sequence>
            <xs:element minOccurs="0" ref="value" oraxdb:propNumber="3792" oraxdb:global="false" oraxdb:SQLName="value" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
            <xs:element ref="key" oraxdb:propNumber="3793" oraxdb:global="false" oraxdb:SQLName="key" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="value" type="xs:string" oraxdb:propNumber="3795" oraxdb:global="true" oraxdb:SQLName="value" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:defaultTable="value748_TAB" oraxdb:defaultTableSchema="MYUSER"/>
      <xs:element name="key" type="xs:string" oraxdb:propNumber="3796" oraxdb:global="true" oraxdb:SQLName="key" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:defaultTable="key747_TAB" oraxdb:defaultTableSchema="MYUSER"/>
      <xs:element name="actionSubId" type="xs:integer" oraxdb:propNumber="3797" oraxdb:global="true" oraxdb:SQLName="actionSubId" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:defaultTable="actionSubId746_TAB" oraxdb:defaultTableSchema="MYUSER"/>
      <xs:element name="time" type="xs:integer" oraxdb:propNumber="3798" oraxdb:global="true" oraxdb:SQLName="time" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:defaultTable="time745_TAB" oraxdb:defaultTableSchema="MYUSER"/>
      <xs:element name="reservationType" type="xs:string" oraxdb:propNumber="3799" oraxdb:global="true" oraxdb:SQLName="reservationType" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:defaultTable="reservationType744_TAB" oraxdb:defaultTableSchema="MYUSER"/>
      <xs:element name="softwareVersion" type="xs:string" oraxdb:propNumber="3800" oraxdb:global="true" oraxdb:SQLName="softwareVersion" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:defaultTable="softwareVersion743_TAB" oraxdb:defaultTableSchema="MYUSER"/>
      <xs:element name="eventId" type="xs:string" oraxdb:propNumber="3801" oraxdb:global="true" oraxdb:SQLName="eventId" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:defaultTable="eventId742_TAB" oraxdb:defaultTableSchema="MYUSER"/>
      <xs:element name="vin" type="xs:string" oraxdb:propNumber="3802" oraxdb:global="true" oraxdb:SQLName="vin" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:defaultTable="vin741_TAB" oraxdb:defaultTableSchema="MYUSER"/>
    </xs:schema>
    
    
    
    
    

    How can I create an index on these tables of the ordered collection to improve performance?

    I found the example at http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/xdb_rewrite.htm#ADXDB5859 but am not able to apply to this particular case...

    Thank you in advance...

    If the schema is not annotated and XS: Integer and XS: String are mapped to types of data NUMBER and VARCHAR2 (4000), so you must use in your query to avoid typecasting unnecessary operations.

    You must also use XMLTABLEs chained when accessing a parent/child instead of a FLWOR expression relationship, otherwise the CBO cannot rewrite the XQuery query correctly (maybe it's fixed in the latest version).

    If you make these changes, the plan should show the cleaner predicates:

    SQL > SELECT EVENT_ID, MESSAGE_ID, ACTION_TYPE, ACTION_SUB_ID, ACTION_TIMESTAMP

    2 FROM test_table

    3 XMLTABLE ('/ monitoring ')

    4 COLUMNS XML_CONTENT OF PASSAGE

    5 WAY of VARCHAR2 (4000) EVENT_ID "ID."

    6 actions for XMLTYPE PATH 'action '.

    (7) T1,

    8 XMLTABLE ('/ action')

    Shares of PASSAGE 9 COLUMNS

    NUMBER of ACTION_SUB_ID 10 PATH "actionSubId."

    11 PATH of VARCHAR2 (4000) ACTION_TYPE "type."

    12 WAY of NUMBER ACTION_TIMESTAMP 'time '.

    (13) T2

    14 WHERE EVENT_ID IS NOT NULL

    15 AND ACTION_SUB_ID IS NOT NULL

    16;

    Execution plan

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

    Hash value of plan: 1763884463

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

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

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

    |   0 | SELECT STATEMENT |                 |   109.   220K |     6 (17). 00:00:01 |

    |   1.  THE MERGE JOIN.                 |   109.   220K |     6 (17). 00:00:01 |

    |*  2 |   TABLE ACCESS BY INDEX ROWID | TEST_TABLE |    11.   352.     2 (0) | 00:00:01 |

    |   3.    INDEX SCAN FULL | SYS_C007567 |    11.       |     1 (0) | 00:00:01 |

    |*  4 |   JOIN TYPE.                 |   109.   216K |     4 (25) | 00:00:01 |

    |*  5 |    TABLE ACCESS FULL | T_OR_MON_ACTION |   106 S 216K |     3 (0) | 00:00:01 |

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

    Information of predicates (identified by the operation identity card):

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

    2 - filter("TEST_TABLE".") (' SYS_NC00012$ ' IS NOT NULL)

    4 - access("SYS_ALIAS_0".") NESTED_TABLE_ID "=" TABLE_TEST. " ("' SYS_NC0000800009$ ')

    filter ("SYS_ALIAS_0". "NESTED_TABLE_ID"="TABLE_TEST" "." " ("SYS_NC0000800009$")

    5 - filter("SYS_ALIAS_0"." actionSubId» IS NOT NULL)

    Note

    -----

    -dynamic sample used for this survey (level = 2)

    Now, if it is still necessary, everything boils down to choosing a technique for index NULL values:

    -composite index with a column not zero or constant

    -FBI

    -bitmap image

    Choose the one that best fits your data, the selectivity and activity on the tables.

  • OSB tuning issues

    Hi all!
    After some problems with the larger requests, I need to investigate the flow of my message, and I have a few questions.

    1. so if I use $body to assign to the OriginalBody variable at the beginning of the flow - it creates copy full size in memory so if the body is 5 MB, there will be additional 5 MB assigned?

    2. often, I have a lot to assign multiple actions, as
    Assign $ Element/body [1] / id/text () to the variable Id
    Assign the $body / Element [1] / name/text () in the name of the variable
    etc.
    However, in the tuning OSB doc, I see:
    >
    Created context variables using an action to assign are converted to the XmlBeans and then comes back to the native format of XQuery for the next XQuery. Several actions 'Assign' can be reduced to only one action attribute using a FLWOR expression. Intermediate values can be created using "let" declarations. Avoiding variable creation of context redundant eliminates the overhead associated with internal data format conversions. This advantage must be balanced with the visibility of the code and re-use of variables.
    >
    I don't understand this 'Assign unique action using a FLWOR expression"- any example?

    Thanks again

    1. so if I use $body to assign to the OriginalBody variable at the beginning of the flow - it creates copy full size in memory so if the body is 5 MB, there will be additional 5 MB assigned?

    Yes. When running, the flow of proxy runs as a set of java objects. And variables created in the flow of the messages will end up also being created as objects in memory to the jvm.
    Thus, the more variables created, more the memory footprint.

    'simple action to assign by using a FLWOR expression' - no matter what example?

    An example will be to implement the logic of complex Web - rather than use the actions of the OSB of loop and several actions with-right/replace, you can use the extract below using an assign action+ to perform the same tasks.

    for $v in $doc / / video
    where $v/year = 1999
    return $v/title

    You can get other examples @ http://www.stylusstudio.com/xquery_flwor.html who use FLWOR expressions.

    I hope this helps.

    Thank you
    Patrick

  • Use the attribute as a set of data and analysis of these data

    Hello world
    I present below a challenge (a little) with the use of attributes in XQuery. Consider the following XML document:

    < showroom >
    < car id = "1" >
    < name > Clio < / name >
    < family > Renault < / family >
    < / car >
    ...
    < id car = "n" >
    < name > Q5 < / name >
    Audi > family < < / family >
    < / car >
    < / showroom >

    Each customer of the showroom is identified by a unique Id (for example, 1,2,3,...). Then, I want to add some data to my XML document that must represent, for each car, all of the IDs of all the customers who have rented this car.
    The desired XML document might look like this:

    < showroom >
    < car id = "1" >
    < name > Clio < / name >
    < family > Renault < / family >
    + * < history > * +.
    + * < client id = "2" / > * +.
    + * < client id = "23" / > * +.
    + * < / history > * +.
    < / car >
    ...
    < id car = "n" >
    < name > Q5 < / name >
    Audi > family < < / family >
    + * < history > * +.
    + * < client id = "56" / > * +.
    + * < / history > * +.
    < / car >
    < / showroom >

    However, using elements to represent the historic location, size of the document will increase considerably.
    As I only use IDs of the IEN, y at - it a way to represent historical data using only the attributes? +.
    In the following document, id of the IEN are represented, as a whole, through the +@history+attribute:
    < showroom >
    < car id = '1' history = '2.23' >
    < name > Clio < / name >
    < family > Renault < / family >
    < / car >
    ...
    < id car = history of "n" = "56" >
    < name > Q5 < / name >
    Audi > family < < / family >
    < / car >
    < / showroom >

    However, y at - there no way to check if a given id = 'x' car was rented by a customer Id = 'y'? +.
    Does anyone know how to represent historical data (sequence of identity of customers), using only the attributes and how to search for a given id of customer as explained above?
    Please suggest. I appreciate your help.

    OK, I thought that you already have a document that stores the relationship between customers and cars.

    Here is an example that will insert or update the attribute of history:

    let $carId := 3
    let $clientId := 56
    return
     copy $doc := fn:doc("c:\dev\xml\showroom.xml")
     modify (
      for $i in $doc/showroom/car
      where $i/@id = $carId
      return if (exists($i/@history))
              then replace value of node $i/@history with concat($i/@history,",",$clientId)
              else insert node attribute history {$clientId} into $i
     )
     return $doc
    

    However, if we are reasoning in terms of standardization, it is better to have these relationships stored as separate elements, be it in the showroom or another XML document. Then you could simply perform a join or use a nested FLWOR expression to retrieve historical data.

    To check if the attribute contains a given customer id:

    let $carId := "3"
    let $clientId := "56"
    let $doc := fn:doc("c:\dev\xml\showroom.xml")
    return fn:exists(fn:tokenize($doc/showroom/car[@id=$carId]/@history, ",")[.=$clientId])
    

    She will return a Boolean value.

    Published by: odie_63 on March 8, 2012 20:19

  • 12 c XML QUERY do not insert

    Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production0
    PL/SQL Release 12.1.0.2.0 - Production0
    CORE12.1.0.2.0Production0
    AMT for Linux: Version 12.1.0.2.0 - Production0
    NLSRTL Version 12.1.0.2.0 - Production0

    When I got it done in 11G everything worked fine. We went to 12 c and now will not take the insert. I have tried with and without the namespace declaration in the xmlquery.

    In light of the following:

    DECLARE

    CLOB xx_xml

    " : = ' < OTA_ResRetrieveRS xmlns =" http://www.OpenTravel.org/OTA/2003/05 "" xmlns: xsi = " http://www.w3.org/2001/XMLSchema-instance " Version = "7" "xsi: schemaLocation =" " http://www.OpenTravel.org/OTA/2003/05 OTA_ResRetrieveRS.xsd" TimeStamp = "2015-05 - 29 T 11: + 00:00 39:03.000000" target = "Test" TargetName = "AUS" TransactionIdentifier = "2910279" > < success / > < errors > < error Type = '0' doc = 'None' / > < / errors > < ReservationsList > < HotelReservation RoomStayReservation = "true" ResStatus = "Internal" > < UniqueID Type = '14' ID = '515254512' / > < Services > < services > < TPA_Extensions > < TPA_Extension > < WiFiFees RateTimeUnit = 'Day' NumberConnections = '4' ConnectionType = "F' LengthOfStay = '9' AmountBeforeTax = '0' stay ="0.00"StayCode ="15"/" "" > < / TPA_Extension > < / TPA_Extensions > < / Service > < / Services > < ResGuests > < ResGuest > < profile > < ProfileInfo > < Type UniqueID = '21' ID = '356855620' / > < profile > < TPA_Extensions > < TPA_Extension > < DRI_INFO MemberLevel = '0' GuestType = 'GST' OwnerStay = "N" / > < / TPA_Extension > < / TPA_Extensions > < customer > < PersonName > < name > Gato < / name > < Chandra GivenName > < / GivenName > < / PersonName > < / customer > < / profile > < / ProfileInfo > < / profiles > < / ResGuest > < / ResGuests > < RoomStays > < ideal > < BasicPropertyInfo HotelCode = "LOL" / > < price > < RoomRate RoomID = code "31605" = "HOB" > < GuestCounts > < GuestCount Count = "1" / > < / GuestCounts > < / RoomRate > < / price > < TimeSpan Start = "2015-05-29" end = "2015-06-07" / > < / ideal > < / RoomStays > < / documents > < / ReservationsList > < / OTA_ResRetrieveRS > ';

    rratechart xmltype.

    XMLTYPE x_xml;

    ratechart XMLTYPE.

    x_elements xmlsequencetype: = xmlsequencetype ();       -It comes to xmlelements table. element is added to it.

    INDX directory: = 1;

    BEGIN

    x_xml: = xmltype (xx_xml); .createschemabasedxml ("OTA_ResRetrieveRS.xsd");

    IF x_xml.isschemabased () = 0

    THEN

    Dbms_output.put_line (' GER not basic schema ");

    ON THE OTHER

    Dbms_output.put_line ('pre based schema");

    END IF;

    SELECT XMLELEMENT ('RATES'

    , xmlattributes ("1" AS 'DAYS'

    , '2.95 "AS 'UPGRADE'.

    , "5.95"AS 'LEVEL-10'.

    "8.90" AS 'LEVEL-20')) "."

    IN rratechart

    FROM DUAL;

    x_elements. EXPAND ();

    (indx) x_elements: = rratechart;

    INDX: = indx + 1;

    SELECT XMLELEMENT ('RATES'

    , xmlattributes ("5" AS 'DAYS'

    , "5.95"AS 'UPGRADE'.

    , "7.95' AS 'LEVEL-10.

    "9.90" AS 'LEVEL-20')) "."

    IN rratechart

    FROM DUAL;

    x_elements. EXPAND ();

    (indx) x_elements: = rratechart;

    INDX: = indx + 1;

    SELECT XMLELEMENT ('RATES'

    , xmlattributes ("7" AS 'DAYS'

    , "15.95"AS 'UPGRADE'.

    , "17.95' AS 'LEVEL-10.

    "19.90" AS 'LEVEL-20')) "."

    IN rratechart

    FROM DUAL;

    x_elements. EXPAND ();

    (indx) x_elements: = rratechart;

    INDX: = indx + 1;

    SELECT XMLAGG (COLUMN_VALUE) IN TABLE ratechart (x_elements);

    SELECT XMLQUERY ('declare namespace ota = "http://www.opentravel.org/OTA/2003/05"; "")

    copy $i: = $p1

    Edit)

    for $j in $i/OTA_ResRetrieveRS/ReservationsList/documents/Services/Service/TPA_Extensions/TPA_Extension/WiFiFees

    return)

    Insert the node $p2 after $j

    )

    )

    Return $i "PASSAGE x_xml AS 'p1', ratechart 'p2' RETURN CONTENT)

    IN x_xml

    FROM DUAL;

    -Clean the unused attributes.

    x_xml: =.

    x_xml. () DELETEXML

    "OTA_ResRetrieveRS/ReservationsList/HotelReservation/Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@Stay");

    x_xml: =.

    x_xml. () DELETEXML

    "OTA_ResRetrieveRS/ReservationsList/HotelReservation/Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@StayCode");

    x_xml: =.

    x_xml. () DELETEXML

    "OTA_ResRetrieveRS/ReservationsList/HotelReservation/Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@RateTimeUnit");

    x_xml: =.

    x_xml. () DELETEXML

    "OTA_ResRetrieveRS/ReservationsList/HotelReservation/Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@AmountBeforeTax");

    IF x_xml.isschemabased () = 0

    THEN

    Dbms_output.put_line ('no Schema based");

    ON THE OTHER

    Dbms_output.put_line ('based Schema");

    END IF;

    Dbms_output.put_line (ratechart.getstringval ());

    Dbms_output.put_line (x_xml.getstringval ());

    END;

    This returns the following:

    Based pre schema

    No schema based

    < RATES DAYS = '1' = "2.95" upgrade LEVEL-10 = "5.95" LEVEL-20 = "8.90" > < / RATES > < RATES DAYS = "5" = "5.95" UPGRADE LEVEL-10 = "7.95" LEVEL-20 = "9.90" > < / RATES > < RATES DAYS = '7' upgrade "15.95" = LEVEL-10 = "17.95' LEVEL-20 ="19.90"> < / RATES >

    " < OTA_ResRetrieveRS xmlns =" http://www.OpenTravel.org/OTA/2003/05 "" xmlns: xsi = " http://www.w3.org/2001/XMLSchema-instance " Version = "7" "xsi: schemaLocation =" " http://www.OpenTravel.org/OTA/2003/05 OTA_ResRetrieveRS.xsd" TimeStamp = "2015-05 - 29 T 11: + 00:00 39:03.000000" target = "Test" TargetName = "AUS" TransactionIdentifier = "2910279" > < success / > < errors > < error Type = '0' doc = 'None' / > < / errors > < ReservationsList > < HotelReservation RoomStayReservation = "true" ResStatus = "Internal" > < UniqueID Type = '14' ID = '515254512' / > < Services > < services > < TPA_Extensions > < TPA_Extension > < WiFiFees RateTimeUnit = 'Day' NumberConnections = '4' ConnectionType = "F' LengthOfStay = '9' AmountBeforeTax = '0' stay ="0.00"StayCode ="15"/" "" > < / TPA_Extension > < / TPA_Extensions > < / Service > < / Services > < ResGuests > < ResGuest > < profile > < ProfileInfo > < Type UniqueID = '21' ID = '356855620' / > < profile > < TPA_Extensions > < TPA_Extension > < DRI_INFO MemberLevel = '0' GuestType = 'GST' OwnerStay = "N" / > < / TPA_Extension > < / TPA_Extensions > < customer > < PersonName > < name > Gato < / name > < Chandra GivenName > < / GivenName > < / PersonName > < / customer > < / profile > < / ProfileInfo > < / profiles > < / ResGuest > < / ResGuests > < RoomStays > < ideal > < BasicPropertyInfo HotelCode = "LOL" / > < price > < RoomRate RoomID = code "31605" = "HOB" > < GuestCounts > < GuestCount Count = "1" / > < / GuestCounts > < / RoomRate > < / price > < TimeSpan Start = "2015-05-29" end = "2015-06-07" / > < / ideal > < / RoomStays > < / documents > < / ReservationsList > < / OTA_ResRetrieveRS >

    If we have not been through any of this before? Seems that Yes.

    Declare a namespace prefix is fine, but you do not actually use.

    In any case, use a declaration of default namespace in this case.

    Your delete operations can also be integrated in the XQuery Update expression entirely:

    DECLARE

    xx_xml CLOB: =.

    ' ' ' 'http://www.opentravel.org/OTA/2003/05 "xmlns: xsi ="http://www.w3.org/2001/XMLSchema-instance"Version = '7'" xsi: schemaLocation = "http://www.opentravel.org/OTA/2003/05 OTA_ResRetrieveRS.xsd" TimeStamp = "2015-05 - 29 T 11: + 00:00 39:03.000000" Target = 'Test' TargetName = "AUS" TransactionIdentifier = "2910279" >

    Gato Chandra

    ';

    XMLTYPE x_xml;

    ratechart XMLTYPE.

    x_elements xmlsequencetype: = xmlsequencetype();

    BEGIN

    x_xml: = xmltype (xx_xml);

    x_elements.extend (3);

    Select xmlelement ("RATES"

    , xmlattributes ('1' 'DAYS', "2.95 ' AS 'UPGRADE',' 5.95 ' AS ' LEVEL-10", "8.90 ' AS ' LEVEL-20" "" "")

    )

    in x_elements (1)

    Double;

    Select xmlelement ("RATES"

    , xmlattributes ('5' AS 'DAYS', "5.95 ' AS 'UPGRADE',' 7.95 ' AS ' LEVEL-10", "9.90 ' AS ' LEVEL-20" "" "")

    )

    in x_elements (2)

    Double;

    Select xmlelement ("RATES"

    , xmlattributes ('7' AS 'DAYS', "15.95 ' AS" UPGRADE"," 17,95' AS 'LEVEL-10',' 19,90' AS ' LEVEL-20 "")

    )

    in x_elements (3)

    Double;

    Select xmlagg (column_value) in the table ratechart (x_elements);

    Select (xmlquery

    ' declare default element namespace "http://www.opentravel.org/OTA/2003/05";

    copy $i: = $p1

    Edit)

    for $j in $i/OTA_ResRetrieveRS/ReservationsList/documents/Services/Service/TPA_Extensions/TPA_Extension/WiFiFees

    return)

    Insert the node $p2 after $j

    delete the node $j/@Stay

    delete the node $j/@StayCode

    delete the node $j/@RateTimeUnit

    delete the node $j/@AmountBeforeTax

    )

    )

    Return $i"

    passing x_xml AS "p1".

    , ratechart AS 'p2 '.

    contents of return

    )

    in x_xml

    Double;

    dbms_output.put_line (x_xml.getclobval (1,2));

    END;

    /

    Output:

    Deleted attributes and nodes inserted RATES, but know that they belong to no namespace (as planned), which is probably not what you want.

    "" http://www.OpenTravel.org/OTA/2003/05"xmlns: xsi ="http://www.w3.org/2001/XMLSchema-instance"Version ="7"" xsi: schemaLocation = "http://www.opentravel.org/OTA/2003/05 OTA_ResRetrieveRS.xsd" TimeStamp = "2015-05 - 29 T 11: + 00:00 39:03.000000" Target = "Test" TargetName = "AUS" TransactionIdentifier = "2910279" >

    Gato

    Chandra

Maybe you are looking for