extraction of xmltype table in the xml output: redundant nodes

Hi guys - see example below.  (edit: Sorry, did not use these forums for a while and can't seem to understand how to format the code...)

[code] SQL > select *.

the v version $2;

BANNER

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

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

PL/SQL Release 11.2.0.4.0 - Production

CORE Production 11.2.0.4.0

AMT for Linux: Version 11.2.0.4.0 - Production

NLSRTL Version 11.2.0.4.0 - Production

[/ code]

[/ code]

SQL > create table mytesttable (item_id issue, x_data xmltype);

Table created.

SQL >

SQL > insert into mytesttable

2 with dat (select ' blah' point of double

3 Union all the

4 Select "blah" more than double)

5, t as (select xmlelement ("x_data"

6, xmlattributes (1 as "dummyattr")

7, xmlagg (xmlelement ("item"

8                                                ,item))

9                              ) x_data

10 dat

11              )

12. Select 1, x_data

13 t;

1 line of creation.

SQL >

SQL > select *.

2 of mytesttable;

ITEM_ID

----------

X_DATA

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

-------

1

< x_data dummyattr = "1" >

< item > blah < / item >

< element > more blah < / item >

< / x_data >

1 selected line.

SQL >

SQL > select xmlelement ("outerelement"

2, xmlelement ("itemID", item_id)

3, xmlelement ("x_data", x_data)

4                   )

5 mytesttable;

XMLELEMENT ("OUTERELEMENT", XMLELEMENT("ITEMID",ITEM_ID), XMLELEMENT("X_DATA",X_DATA))

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

-------

< outerelement > < itemID > 1 < / itemID > < x_data > < x_data dummyattr = "1" >

< item > blah < / item >

< element > more blah < / item >

< / x_data >

< / x_data > < / outerelement >

1 selected line.

[/ code]

Like the above, I have an xmltype in a table that has other non-xmltype columns.   I have a requirement to extract them out in a single xml document in a manner similar to the last SQL it.

the problem is that if I do it according to the foregoing, I add a redundant node artificially.  the first node < x_data > is not necessary, but how can I go and add the xmltype column to the result without having to qualify it with another element around it?

know how to do the following:

< outerelement > < itemID > 1 < / itemID > < x_data dummyattr = "1" >

< item > blah < / item >

< element > more blah < / item >

< / x_data > < / outerelement >

?

Too bad... I had a moment mute:

Select xmlelement ("outerelement"

xmlelement ("itemID", item_id)

x_data

)

of mytesttable;

Tags: Oracle Development

Similar Questions

  • Adding namespace to the XML output

    Hello

    I have a requirement to generate an XML document for the columns in the table. I use DBMS_XMLgen.getXML inside my procedure to get the XML document.

    The result I get after my procedure is:

    <? XML version = "1.0"? >
    < EMP >
    < EMPLOYEE_NO > 000017 < / EMPLOYEE_NO >
    ASSETS of < EMPLOYEE_STATUS > < / EMPLOYEE_STATUS >
    Mini < NAME_LAST > < / NAME_LAST >
    < NAME_FIRST / >
    < / EMP >

    But I also need to prefix and uri of namespace in the xml output. Is it possible to add the prefix and namespace uri to the xml output.

    So what I need, is something like below one:

    <? XML version = "1.0"? >
    < xs:EMP > xmlns: out = "http://xmlns:out="http:/example.org/ver1.0/ThisISTest#">
    < xs:EMPLOYEE_NO > 000017 < / xs:EMPLOYEE_NO >
    ACTIVE < xs:EMPLOYEE_STATUS > < / xs:EMPLOYEE_STATUS >
    Mini < xs:NAME_LAST > < / xs:NAME_LAST >
    < xs:NAME_FIRST / >
    < / xs:EMP >


    Any solutions or examples of code on it would be a great help.

    Thanks in advance.

    Strange...

    OK, back to the basics:

    What is your version of db (all four digits please)?

    The following gives the expected result?

    select xmltype('
    
    000017
    ACTIVE
    Mini
    
    ').transform(
     xmltype(
    '
    
    
    
    
    
    
    '
     )
    ).getClobVal()
    from dual;
    
  • What is the best way to apply choice relational tables in the XML document?

    I've got an XML document from outside I turn with full DB XSLT document.

    Some parts of the document contain codes I want to tranfsorm to significant labels of relational tables in our database.

    On road is to disassemble the XML into the relational views and join these views with tables of choice and then back, this time with labels translated, using XMLElement, etc...

    Is there another way less heavy? For example,.

    Select updateXML)
    xml_dta
    ,'/ / section_to_translate/node_to_translate/variable / text () '
    ,(
    Select the label
    of table_recherche
    where Group = extractValue (current_node, '... / Group/Text () ')
    and code = extractValue (current_node, '... / variable/Text () ')
    )
    ) xml_dta
    from my_table
    where... criteria

    However, I do not know how to move from the current node to the extractValue function (if it is possible?.)

    Anyone done the second way?

    Thank you

    You didn't tell the version of your database, so I assume one of them later.

    You can include the part of the translation in the XSL transformation, by accessing an external research paper generated from the database beforehand.

    Here is an example of use of the HR diagram example:

    (1) the source document that are to be processed: emp.xml

    
    
     
      198
      Donald
      OConnell
      SH_CLERK
     
     
      199
      Douglas
      Grant
      SH_CLERK
     
     
      200
      Jennifer
      Whalen
      AD_ASST
     
     
      201
      Michael
      Hartstein
      MK_MAN
     
     
      202
      Pat
      Fay
      MK_REP
     
     
      203
      Susan
      Mavris
      HR_REP
     
     
      204
      Hermann
      Baer
      PR_REP
     
     
      205
      Shelley
      Higgins
      AC_MGR
     
     
      206
      William
      Gietz
      AC_ACCOUNT
     
     
      100
      Steven
      King
      AD_PRES
     
    
    

    (2) the lookup table:

    SQL> create table lookup_table as
      2  select job_id, job_title
      3  from hr.jobs;
    
    Table created
    
    SQL> select * from lookup_table;
    
    JOB_ID     JOB_TITLE
    ---------- -----------------------------------
    AD_PRES    President
    AD_VP      Administration Vice President
    AD_ASST    Administration Assistant
    FI_MGR     Finance Manager
    FI_ACCOUNT Accountant
    AC_MGR     Accounting Manager
    AC_ACCOUNT Public Accountant
    SA_MAN     Sales Manager
    SA_REP     Sales Representative
    PU_MAN     Purchasing Manager
    PU_CLERK   Purchasing Clerk
    ST_MAN     Stock Manager
    ST_CLERK   Stock Clerk
    SH_CLERK   Shipping Clerk
    IT_PROG    Programmer
    MK_MAN     Marketing Manager
    MK_REP     Marketing Representative
    HR_REP     Human Resources Representative
    PR_REP     Public Relations Representative
    
    19 rows selected
     
    

    (3) generate us the document search and store it in the XML DB repository (so that it can be referenced in the XSLT):

    SQL> show user
    User is "dev"
    
    SQL>
    SQL> declare
      2   res boolean;
      3  begin
      4   res := dbms_xdb.CreateResource(
      5    abspath => '/public/temp/lookup.xml',
      6    data => dburitype('/DEV/LOOKUP_TABLE').getXML
      7   );
      8   commit;
      9  end;
     10  /
    
    PL/SQL procedure successfully completed
    
    SQL> set long 10000
    SQL> select xdburitype('/public/temp/lookup.xml').getCLOB() from dual;
    
    XDBURITYPE('/PUBLIC/TEMP/LOOKU
    --------------------------------------------------------------------------------
    
    
      
        AD_PRES
        President
      
      
        AD_VP
        Administration Vice President
      
      
        AD_ASST
        Administration Assistant
      
      
        FI_MGR
        Finance Manager
      
      
        FI_ACCOUNT
        Accountant
      
      
        AC_MGR
        Accounting Manager
      
      
        AC_ACCOUNT
        Public Accountant
      
      
        SA_MAN
        Sales Manager
      
      
        SA_REP
        Sales Representative
      
      
        PU_MAN
        Purchasing Manager
      
      
        PU_CLERK
        Purchasing Clerk
      
      
        ST_MAN
        Stock Manager
      
      
        ST_CLERK
        Stock Clerk
      
      
        SH_CLERK
        Shipping Clerk
      
      
        IT_PROG
        Programmer
      
      
        MK_MAN
        Marketing Manager
      
      
        MK_REP
        Marketing Representative
      
      
        HR_REP
        Human Resources Representative
      
      
        PR_REP
        Public Relations Representative
      
    
     
    

    (4) the sheet XSLT stylesheet (stored in XDB repository as well): emp.xsl

    
    
     
     
     
     
     
      
     
     
     
      
      
       
       
        
       
      
     
    
    

    The transformation is rather bland, but the interesting part lies in access to external document within it.
    I used a key to index the JOB_ID/function pairs.

    (5) last step, apply the transformation:

    SQL> select xmlserialize(document
      2   xmltransform(
      3    xmltype(bfilename('DUMP_DIR','emp.xml'),nls_charset_id('AL32UTF8')),
      4    xdburitype('/public/temp/emp.xsl').getXML()
      5   ) as clob indent
      6  )
      7  from dual;
    
    XMLSERIALIZE(DOCUMENTXMLTRANSF
    --------------------------------------------------------------------------------
    
    
      
        Donald OConnell
        Shipping Clerk
      
      
        Douglas Grant
        Shipping Clerk
      
      
        Jennifer Whalen
        Administration Assistant
      
      
        Michael Hartstein
        Marketing Manager
      
      
        Pat Fay
        Marketing Representative
      
      
        Susan Mavris
        Human Resources Representative
      
      
        Hermann Baer
        Public Relations Representative
      
      
        Shelley Higgins
        Accounting Manager
      
      
        William Gietz
        Public Accountant
      
      
        Steven King
        President
      
    
     
    

    The input document is transformed and each job_id is replaced by its corresponding label.

  • Using the overall table for the XML results

    I'm new in the flash script and it drives me crazy...

    I searched the internet and I could not find a solution for this.

    I am trying to load XML, analyze the values in the global table and use this picture later in my code... it does not work.

    _Global.AutoID = Array ();

    function ParsingXML() { }

    var pokXML:XML = new XML();

    pokXML.ignoreWhite = true;

    pokXML.onLoad = function (loaded) { }

    If (loaded) { }

    var full_niz:Array = pokXML.firstChild.childNodes;

    len:Number=full_niz.length-1//getting the number of child nodes var

    for (var i: Number = 0; i < = len; i ++) //looping hollow values

             {

    _global.AutoID [i] = full_niz [i] Sublst.ChildNodes(1).ChildNodes(0) [0] .firstChild;

              }

    trace (_global.autoid);  Back table OK

    out of //function return _global.autoid;

         }else{

    trace ("not OK");

         }

    } //end function (loaded)

    pokXML.load ("my.xml");

    } //end ParsingXML function

    ParsingXML();  return empty array [virtue]

    How to make this work?

    Sorry for my English (bad)

    Try:

    _Global.AutoID = new Array();

    function ParsingXML() {}

    var pokXML:XML = new XML();

    pokXML.ignoreWhite = true;

    pokXML.onLoad = {function (loaded)}

    If {(responsible)

    var full_niz:Array = pokXML.firstChild.childNodes;

    var len:Number=full_niz.length-1//getting the number of child nodes

    for (var i: Number = 0; i<=len;i++) looping="" trough="" the="">

    {

    AutoID [i] = full_niz [i] Sublst.ChildNodes(1).ChildNodes(0) [0] .firstChild;

    }

    Table //return OK track (_Global.AutoID)

    Return _global.autoid; pokXML.onLoad is asynchronous if it does not make sense to have a return.

    } else {}

    trace ("not OK");

    }

    } //end function (loaded)

    pokXML.load ("my.xml");

    } //end ParsingXML function

    ParsingXML();  return empty array [virtue]

  • create table from the XML file at several levels

    Hello

    I'm working on the provision of an app to display xml data, which are currently using data from the settings file where the data was stored in a table.

    CONT =]
    [{txt: 'Perfume'} //main menu]

    [[{txt: 'Top Note', framework: 'topNote'}, {txt: 'Heart notes', frame: "heartNote"}, {txt: frame, 'Note of Base': 'gaps'}] / / submenu]

    ,[
    {txt: 'Packaging', field: 'packaging'} / / main menu

    ]

    ]

    I created an xml file and am able to recover data and impossible to find the same.

    Here's the xml file

    < Products >
    < produces txt = setting "Perfume" = "" > "".
    < = frame 'Top Note' = "topNote" txt file name > < / name of the file >
    < = txt file name ' heart notes"frame ="heartNote"> < / name of the file >
    < file name txt = "Core score" frame = 'gaps' > < / name of the file >
    < / product >
    < produces txt = framework of 'Packaging' = 'packaging' > < / product >
    < produces txt = framework "3D Animation" = "tvAd" video = "true" flvName = "video.flv" w = "547" h = "309" > < / product >
    < product txt framework "advertising Lla' = 'the package' = >
    < name of the txt-file = "Print Ad Creative Pack" frame = "printCp" > < / name of the file >
    < / product >
    < / product >

    AS A CODE

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

    (GlobalVarContainer.myXML is the place where is stored the xml file)

    var node:XMLNode = GlobalVarContainer.myXML.firstChild;
    var navItm:int = int (node.childNodes.length);
    for (i = 0; i < wheel; i ++) {}

    var temp_array:Array = new Array();
    var subnavCount:int = int (node.childNodes [i].childNodes.length);     subnav
    var obj:Object = new Object();
    obj.txt = node.childNodes [i] .attributes ['txt ""]
    obj. Frame = node.childNodes [i] .attributes ["frame" "]
    trace (node.childNodes [i]. Attributes ['txt'])

    for (var j: int = 0; j < subnavCount; j ++)
    {
    trace (node.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [j]. Attributes ['txt'])
    obj.subtxt = node.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [j]. Attributes ['txt'];
    obj. Subframe = node.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [j]. Attributes ['frame'];
    temp_array.push (obj);
    }
    GlobalVarContainer.my_array.push (temp_array);

    }

    If I add - trace (GlobalVarContainer.my_array); -to code the outout is

    [object Object], [object Object], [object Object]
    [object Object], [object Object], [object Object],.
    [object Object], [object Object], [object Object],.
    [object Object], [object Object], [object Object], [object Object]

    but trace (.txt [i] GlobalVarContainer.my_array + "array"); or trace (GlobalVarContainer.my_array [i] [0] .txt + "array"); no results.

    need advice to move forward from here.

    Thank you

    AYUSH

    What I meant is that if you load the XML e4x, you have to analyze in a table to use it. You can retrieve the syntax of e4x XMLList and use it directly in your code. You can treat the XMLList almost as you treat any array using a for each loop for example.

    Take the code below as an example and adapt it to your needs:

    var mainMenu:XMLList = this.testXML.menu;

    for each {var menu: XML (in mainMenu)}

    trace ("Menu:" + menu.@txt);

    You can use your logic to create menu main point here

    var mynavItem:Navitem = new Navitem (0, spatie * i, GlobalVarContainer.my_array [i] [0], [i, 0], false, true);

    this.holder.addChild (mynavItem); ABLE TO VIEW THE MAIN MENU

    var items: XMLList = menu.children ();

    If (items.length () > 0) {}

    for each {var point: XML (in the points)}

    trace ("point:" + item.@txt);

    Logic of creation of subitem here

    var mySubnavItem:Navitem = new Navitem (dash, spatie * (i + 1 + j), GlobalVarContainer.my_array [i] [2], [i, j], true);

    this.holder.addChild (mySubnavItem);        DISPLAYS ONLY THE LAST ENTRY IN THE SUBMENU

    }

    }

    }

  • Center aligning images in table using the XML file

    Hello
    I use a flash file that uses an xml file to download a series of images one by one in a photo-gate.
    There are two different widths of images. The height is always the same. Is it possible to set up so that each image that calls file xml is center aligned as part of image.
    At the present time when using the xml file to load the image she always left aligns the image when he brings it in image even if you change the alignment to center align in the Panel align.
    Does anyone have a suggestion why this happens or how to fix it?
    Thanks for the help

    I did this quickly and did not test - but if it does not directly at the exit it might give you a starting point - or someone else can correct if there are errors. I'll check tomorrow - where I am its time to go to sleep...
    CHANGE the DETAILS: Just changed a few pieces of code I posted last night - I forgot to change the statement holder_mc.loadMovie in xml.onLoad Manager. I have not tested, but its along the lines of the approach I would use to solve your problem with resizing the image. Let me know how you go with it.

  • The results in the debugger do not correspond with the result in the xml output is spent OPA


    Hello

    I use the OPM Version 10.4.6. I am facing a problem where I have a result field which is calculated by OPM in session of the debugger gives the correct result. While the same field has a different value in the output xml file passed from OPA to another system. Please give some advice on above question.

    Kind regards

    Mounia

    Sorry, I did not respond earlier. Do you have a support call opened in this regard, otherwise there is someone who has a very similar problem.

    I answered internally on this and the problem seems to be that of mathematical accuracy and very low values, which are then compared with zero. The debugger uses a .net implementation that can give slightly different numerical values at the extremes. I think that your rules would benefit from a degree of rounding applied before you test for equality with anything. Note the type of value that I've seen is 4-16

    I have provided more information to Schneider, who also provided a (Simplified) modules and some sample data.

    The debugger uses essentially the same engine of determinations and in general, you will see exactly the same result except that you've discovered to some extremely small numbers. In your case even if the value is 4-16 in the debugger and 0 in the API (or vice versa) the effect that has on the logic is that a single value is zero, so that the other does not which translates an extra 1000 added and results of 1000 and 2000 respectively.

    Concerning

    Ian

  • Extracting data from table using the date condition

    Hello

    I have a table structure and data as below.

    create table of production
    (
    IPC VARCHAR2 (200),
    PRODUCTIONDATE VARCHAR2 (200),
    QUANTITY VARCHAR2 (2000).
    PRODUCTIONCODE VARCHAR2 (2000).
    MOULDQUANTITY VARCHAR2 (2000));

    Insert into production
    values ('1111 ', '20121119', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20121122', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20121126', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20121127', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20121128', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20121201', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20121203', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20121203', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20130103', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20130104', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20130105', ' 1023', 'AAB77',' 0002');


    Now, here I want to extract the data with condition as

    PRODUCTIONDATE > = the current week Monday

    so I would skip only two first rows and will need to get all the lines.

    I tried to use it under condition, but it would not give the data for the values of 2013.

    TO_NUMBER (to_char (to_date (PRODUCTIONDATE, 'yyyymmdd'), 'IW')) > = to_number (to_char (sysdate, 'IW'))

    Any help would be appreciated.

    Thank you
    Mahesh

    Hello

    HM wrote:
    by the way: it is generally a good idea to store date values in date columns.

    One of the many reasons why store date information in VARCHAR2 columns (especially VARCHAR2 (200)) is a bad idea, it's that the data invalid get there, causing errors. Avoid the conversion of columns like that at times, if possible:

    SELECT     *
    FROM     production
    WHERE     productiondate     >= TO_CHAR ( TRUNC (SYSDATE, 'IW')
                              , 'YYYYMMDD'
                           )
    ;
    
  • to the xml output

    I am sql developer 10g version.
    now, I want to see released in Formate of xml...

    the syntex below does not can not someone help?


    Select * from employees for xml auto;

    I answered this last week, but it seems to have been deleted for some reason any.

    Discover the DBMS_XMLGEN package:

    Select dbms_xmlgen.getxml ("select * from employees where rownum")< 6')="" xml="" from="">

    is the equivalent of your example.

  • Ddeleting the second tag line in the XML output

    Hi all

    When I run the following query:

    Select dbms_xmlgen.getxml ("select wo.work_order_no,
    cursor (select regacc.work_order_no, regacc.work_order_task_no, regacc.regulatory_account_no
    of sa_work_orde_reg regacc
    where regacc.work_order_no = wo.work_order_no) Reg_Test
    of sa_work_order wo') xml
    Double;

    I get the following result:

    <? XML version = "1.0"? >
    rowset <>
    < ROW >
    < WORK_ORDER_NO > 1000170 < / WORK_ORDER_NO >
    < REG_TEST >
    < REG_TEST_ROW >
    < WORK_ORDER_NO > 1000170 < / WORK_ORDER_NO >
    < WORK_ORDER_TASK_NO > 01 < / WORK_ORDER_TASK_NO >
    < REGULATORY_ACCOUNT_NO > 100.2.1 < / REGULATORY_ACCOUNT_NO >
    < / REG_TEST_ROW >
    < / REG_TEST >
    < / ROW >
    < / LINES >

    Now what I need, is remove the second line tag < REG_TEST_ROW >. Y at - it a function or other ways to handle this. I'll use this query in the API of DBMS_XMLGEN.newcontext inside my procedure.

    Thank you for your help in advance.

    Published by: user33333 on June 29, 2010 01:11

    Published by: user33333 on June 29, 2010 01:19

    Hello

    Here are a few options...

    (1) using a scalar subquery rather than the CURSOR constructor (as long as it's supposed to always return a single line):

    SELECT dbms_xmlgen.getxml(
    'SELECT wo.work_order_no,
            ( SELECT XMLForest( regacc.work_order_no,
                                regacc.work_order_task_no,
                                regacc.regulatory_account_no )
              FROM sa_work_orde_reg regacc
              WHERE regacc.work_order_no = wo.work_order_no ) reg_test
    FROM sa_work_order wo'
    ) xml
    FROM dual;
    

    (2) incorporating a XSL transformation (Yes, still!) to copy all nodes except REG_TEST_ROW:

    
    
    
     
      
     
    
    
    
    
    
    

    (3) with the help of a simple replacement out serialized.

  • Analyze the XML order getElementsByTagName node

    Is the order of the elements in a NodeList returned by a rootElement.getElementsByTagName ("item") coherent? I have an XML that returns items in order descending by date (most recent at the top).  Can I count on item (0) is always the most recent and the order preserved?

    As long as your XML file shows how you said, the order does not change.

    Item (0) should be your most recent.

  • Processing the XML file

    I have a requirement to process a stream of xml files and load its content in the oracle as a name-value pair tables. Basically, my table has three columns ID, Detail_NM, Detail_val.  I have to extract the ID and the corresponding details and store it in this table. The XML file looks like in below.  I can use an extract sql but you are looking for the most effective way to do it. I would like to highlight the elements dynamically as an element may or may not be present in every game. for example. Second series below has address2 that isn't there in the first document set. Even if nothing new is introduced, I should be able to treat them without explicitly mentioning the name of the element.  Is there a better way to deal with?  Please, share your ideas.  Thanks in advance

    < document >

    < id > 546534 < /ID >

    < details >

    the New York < City > < / City >

    Ave de Rome 45 < address > < / address >

    < zip > 10281 < / Zip >

    < / details >

    < / document >

    < document >

    < id > 6785565 < /ID >

    < details >

    Dallas < City > < / City >

    < address > 56 locust ave < / address >

    < Address2 > 2nd floor < / address >

    < zip > 07454 < / Zip >

    < / details >

    < / document >

    user626688 wrote:

    Thanks again.  Yes, we can have a node root here.

    -What is the average size of a single XML entity? (Number of nodes, size in bytes)? -A file can be up to 2MB size. Each ID can have different elements from 0 to 200 under him. (Each document tag).

    Sorry, missed your last answer once again.

    If there is a root node, it is even simpler.

    And you can certainly use an intermediate binary table of XMLType:

    SQL> begin
      2
      3    -- insert as Binary XMLType
      4    -- optional step for small files
      5    insert into tmp_xml
      6    values (
      7      xmltype(bfilename('TEST_DIR','sample2.xml'), nls_charset_id('AL32UTF8'))
      8    );
      9
    10    -- parse and insert into the target table
    11    insert into my_table (id, detail_nm, detail_val)
    12    select x1.id
    13         , x2.detail_nm
    14         , x2.detail_val
    15    from tmp_xml t
    16       , xmltable('/Documents/Document'
    17           passing t.object_value
    18           columns id       number  path 'Id'
    19                 , details  xmltype path 'Details'
    20         ) x1
    21       , xmltable('/Details/*'
    22           passing x1.details
    23           columns detail_nm  varchar2(256)  path 'local-name(.)'
    24                 , detail_val varchar2(4000) path 'text()'
    25         ) x2 ;
    26
    27  end;
    28  /
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from my_table;
    
            ID DETAIL_NM            DETAIL_VAL
    ---------- -------------------- ------------------------
        546534 City                 New York
        546534 Address              45 Rome Ave
        546534 Zip                  10281
       6785565 City                 Dallas
       6785565 Address              56 locust ave
       6785565 Address2             2nd Floor
       6785565 Zip                  07454
    
    7 rows selected.
    
  • IBY_FD_PAYMENT_FORMAT_TEXT xml output

    Hello

    IBY_FD_PAYMENT_FORMAT_TEXT used to always save the XML output, generally as follows:

    ....

    No extract has been created beforehand. Create extract. Timestamp: Wed Mar 05 12:42:20 WST 2014

    Size of the product extract - doc::590376

    After create extract, extract is not null.

    Check-in first 1 MB of generated excerpt below:

    ==================

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

    After application of a number of CPP (17167654 & 17176017), the XML is no longer registered in the log file.  The log looks like:

    ...

    No extract has been created beforehand. Create extract. Timestamp: Kills Mar 04 15:59:21 WST 2014

    Size of the product extract - doc::23158

    After create extract, extract is not null.

    Start formatting. Timestamp: Kills Mar 04 15:59:25 WST 2014

    Before formatting: Timestamp: kills Mar 04 15:59:25 WST 2014

    Model type: ETEXT

    ...

    Anyone would offer any suggestion as to how restore us this connected XML functionality?

    Thank you

    Hello

    This change was due to a fix implemented in bug 11828195. They have limited xml extracts to be included in the payment format logs instructions when FND 'Statement' debug level is ONE, then the section of code that primts the xml extracted for the log file is included when the FDFormatProgramUtils.java file is version 120.35.12010000.34 or 12.0.x, version 120.30.12000000.39 and more.

    You can still see, but you will need to turn on statement-level debugging.

    Cheryl

  • Validate the XML column when inserting

    Hello

    I'm on 11 GR 2.

    I have a table

    create table root_table (id number, text xmltype);

    I tried to sign up:

    Start

    dbms_xmlschema.registerSchema ('test', xmltype)

    "' < xs: schema xmlns: XS ="http://www.w3.org/2001/XMLSchema"xmlns:xdb ="http://xmlns.oracle.com"elementFormDefault ="unqualified">

    < name XS: complexType 'RootType' = >

    < xs: SEQUENCE >

    < xs: element name = "Required" / >

    < xs: element name = "Énumération" >

    < xs:simpleType >

    < xs:restriction base = "XS: String" >

    < xs:enumeration value = 'A' / >

    < xs:enumeration value = 'B' / >

    < xs:enumeration value = 'C' / >

    < / xs:restriction >

    < / xs:simpleType >

    < / xs: element >

    < xs: element name = "MinLength" >

    < xs:simpleType >

    < xs:restriction base = "XS: String" >

    < xs:minLength value = "4" / >

    < xs:maxLength value = "20" / >

    < / xs:restriction >

    < / xs:simpleType >

    < / xs: element >

    < xs: element name = "MaxLength" >

    < xs:simpleType >

    < xs:restriction base = "XS: String" >

    < xs:minLength value = "1" / >

    < xs:maxLength value = "4" / >

    < / xs:restriction >

    < / xs:simpleType >

    < / xs: element >

    < xs: element name = "MaxOccurs" type = "xs: String" maxOccurs = "2" / >

    < xs: element name = "MinOccurs" minOccurs = '2' maxOccurs = "2" / >

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

    < / xs: SEQUENCE >

    < / xs: complexType >

    < xs: element name = "root" type = "RootType" xdb:defaultTable = "ROOT_TABLE" / >

    ((< / xs: Schema > '));

    end;

    /

    table should point to the table where the XML column is default, I guess that

    is the 'root' in the same line a reference to the name of the xmltype column?

    Now - how do I ensure the XML I have insert in the column "change" is validated against the schema above?

    concerning

    Mette


    For both options, save the diagram with these options (you can substitute the url of course):

    Start

    () dbms_xmlschema.registerSchema

    schemaURL-online "test.xsd.

    schemaDoc-online xmltype (bfilename ('TEST_DIR', 'test.xsd'), 873)

    local-online true

    genTypes-online fake

    genTables-online fake

    enableHierarchy-online dbms_xmlschema. ENABLE_HIERARCHY_NONE

    options-online dbms_xmlschema. REGISTER_BINARYXML

    );

    end;

    /

    Then the #1 option:

    create table root_table)

    Identification number

    text xmltype

    )

    XMLType column can store as xml binary securefile

    XmlSchema 'test.xsd' element 'root '.

    ;

    SQL > insert into root_table values (1,

    2 xmlparse (document

    3'

    4

    5    A

    6 XXXX

    7 12345

    8

    9

    10

    11  ')

    (12);

    insert into root_table values (1,

    *

    ERROR on line 1:

    ORA-31061: error XDB: XML error event

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

    LSX-00222: "12345" is too long (maximum is 4)

    SQL >

    SQL > insert into root_table values (1,

    2 xmlparse (document

    3'

    4

    5    A

    6 XXXX

    7 1234

    8

    9

    10

    11 ')

    (12);

    insert into root_table values (1,

    *

    ERROR on line 1:

    ORA-31061: error XDB: XML error event

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

    LSX-00213: only 1 occurrences of the 'MinOccurs' particle, the minimum is 2

    SQL > insert into root_table values (1,

    2 xmlparse (document

    3'

    4

    5    D

    6 XXXX

    7 1234

    8

    9

    10

    11

    12  ')

    (13);

    insert into root_table values (1,

    *

    ERROR on line 1:

    ORA-31061: error XDB: XML error event

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

    LSX-00290: invalid enumeration choice "D".

    SQL > insert into root_table values (1,

    2 xmlparse (document

    3'

    4

    5    A

    6 XXXX

    7 1234

    8

    9

    10

    11

    12  ')

    (13);

    1 line of creation.

    For the #2 option:

    create table root_table2)

    Identification number

    text xmltype

    )

    XMLType column can store it as clob securefile

    ;

    create or replace trigger root_table2_biu_t

    before the insert or update

    on root_table2

    for each line

    declare

    doc xmltype: =: new.tekst.createSchemaBasedXML ('test.xsd');

    Start

    doc.schemaValidate ();

    end;

    /

    SQL > insert into root_table2 values (1,

    2 xmlparse (document

    3'

    4

    5    D

    6 XXXX

    7 1234

    8

    9

    10

    11

    12  ')

    (13);

    insert into root_table2 values (1,

    *

    ERROR on line 1:

    ORA-31154: invalid XML document

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

    LSX-00290: invalid enumeration choice "D".

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

    ORA-06512: at DEV. "" ROOT_TABLE2_BIU_T ", line 4

    ORA-04088: error during execution of trigger ' DEV. ROOT_TABLE2_BIU_T'

    Both options will perform a validation of strict type.

    There are other possible configurations, such as CLOB based on a storage schema, but this approach is now obsolete.

    If you are only interested in whether the XML instance is valid or not, you can also use a constraint check with the XMLisValid function.

  • Retrieve / search a specific node of the XML file

    Hello

    I have a question about reading the XML (search) in PL SQL file:

    There is an XML file with the following structure:
    <root>
      <Hnode1 attr1="value1" />
      <Hnode2 attr1="value1" /> 
         <node1_of_Hnode2 id="10" personname="Steven"/>
         <node2_of_Hnode2 id="20" personname="Christian"/>
         <node3_of_Hnode2 id="30" personname="Arnold"/>
         .
         .
      <Hnode2/>
    <root/>
    How it is possible to filter a node by one of its attribute value. For example:
    The id of a person - I guess that id = 20. In this case I would like to get the whole node (in this case node2_of_Hnode2) to get the personname = > 'Christian '.
    Just like a SELECT statement (WHERE ID = 20)

    Is it possible to get it in a single order or should it be buckled on all the lines in the Document. Can you please provide an example for me.

    Thank you for advice!

    The basic version is 10.

    Sorry, this is not a version.
    For example:

    SQL> select * from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE     10.2.0.5.0     Production
    TNS for 64-bit Windows: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
     
    

    The use of the extraction of the values?
    1. better in a Select statement. assignment directli in a variable, or by using the xmlquery function?

    PL/SQL or SQL calls to the XMLType methods such as getStringVal() or extract() function should be equivalent (save the change of context).
    However, none of them are the right way to retrieve a scalar value of a given node.
    You must use the rather extractValue() function (SQL only) for immediate release< 11.2="" and="" xmlcast/xmlquery="" starting="" with="">

    Another Question:

    I've seen a lot of options for dealing with XML files.

    In my case only query data in XML files is relevant.

    I've seen to many API called XMLDOM, DMBS_XMLDOM, XMLTYPE...

    When to use these APIs. Can you give me feedback on this please?

    It is a broad topic.
    An appropriate response will depend on your condition.

    -You have to deal with large files and if so what size?
    -Performance/memory management is a concern for you?
    -You want to extract unique values or process the XML content in the form of relational data?

    If you have any specific test cases to show us, please post in the {forum: id = 34} forum and make sure to include all the necessary details (see the FAQ).

    Published by: odie_63 on 23 Feb. 2012 11:35

Maybe you are looking for

  • How can I create a folder?

    Once I have my new iPad Pro, I would like to have a folder to put in all the applications I use never - how can I do? That's all built two and third party apps. Or better yet, is there a way to simply delete/banish from your iPad (I know they're goin

  • Installation upgrade value package

    Belatedly, for various reasons (mainly the uncertainty and concern that I would mess up the computer at an inopportune time), I have round for a second attempt to install the published Package value update January 9, 2008 (with various other latest d

  • Pavilion dv7: bios unlock code

    bios need unlock code error has been 68097028

  • How to connect wired computer to the wireless printer.

    I spent hours on the phone with a representative of brother yesterday to try and get my DCP-L2540DW communicate with my computer without the computer being on wi - fi, without success. We already all this up and running, but we had to get a new route

  • Open the zip downloaded in wordpad files

    Every time I have try and download a zip file, it goes to wordpad and opens in wordpad. What can I do to solve this problem.