CLOB xml

Hi all
I have a table that contain the clob,

Like this:

number of id_flusso;
clob ds_flusso

inside the ds_flusso of the field, there is an xml, and xml inside, there's a code.

I need to write a query that allow me to retriew the id_flusso and a code in the xml code that is stored in the file, how can I achieve this.

Thank you
Francesco

Always give your version of the database in the first place (select * from version$ v).
It will help provide relevant answers.

On 10g:

select id
     , extractvalue(xmltype(xmldoc), '/root/item[@num="1"]/code') code
from documents
;

Tags: Database

Similar Questions

  • CLOB XML to Excel

    I need to generate an Excel file, which is powered from a clob XML column in my data base. I found some examples to do, and I did it in my case by "pieces". Even if it works, a problem occurs when my file trends to be bigger. This problem is a corruption of my result file. Apparently this corruption is due to the method of pieces, because it does not present when the file is small and it produces more when my 'chunks' is smaller in a large file. For example, if I change my code to use pieces of 32765 characters, problems occur so less when I use pieces of 3000 characters.

    My code is like this:

    CREATE OR REPLACE PROCEDURE DPR_CLOBTOFILE (P_FILENAME IN VARCHAR2,
    P_DIR IN VARCHAR2,
    P_CLOB IN CLOB) IS
    --
    DIRECTORY CONSTANT C_AMOUNT: = 32767;
    L_CLOBLEN PLS_INTEGER;
    L_FHANDLER UTL_FILE. TYPE_DE_FICHIER;
    L_BUFFERSIZE PLS_INTEGER: = 3000;
    L_BUFFAUX VARCHAR2 (3000);
    --
    BEGIN
    --
    L_CLOBLEN: = DBMS_LOB. GETLENGTH (P_CLOB);
    L_FHANDLER: = UTL_FILE. FOPEN (P_DIR, P_FILENAME, 'W', C_AMOUNT);
    --
    FOR I IN 1... CEIL(L_CLOBLEN / L_BUFFERSIZE) LOOP
    --
    DBMS_LOB. READ (P_CLOB,
    L_BUFFERSIZE,
    (I - 1) * L_BUFFERSIZE + 1,
    L_BUFFAUX);
    UTL_FILE. PUT_LINE (L_FHANDLER, L_BUFFAUX, TRUE);
    --
    END LOOP;
    --
    UTL_FILE. FCLOSE (L_FHANDLER);
    --
    EXCEPTION
    WHILE OTHERS THEN
    --
    IF UTL_FILE.IS_OPEN (L_FHANDLER) THEN
    UTL_FILE. FCLOSE (L_FHANDLER);
    END IF;
    LIFT;
    --
    END;


    My result file looks like this:

    PURA Estrategia fine VPA
    < td > Renta Fund USD
    < td > 13
    < td > 1
    4
    51
    04/03/2013
    53
    < td > 13
    79
    11
    105
    < td > 999
    < td > 8
    116
    1
    < td > 999
    1
    NORIGIN SORIGIN_DESC NFROMFUNDS FONDO_x0020_ORIGEN NTOFUNDS FONDO_x0020_DESTINO NSTATREGT DCOMPDATE NUSERCODE
    1 cot. Voluntaria 2 Baring Europa 2 Baring Europa USD USD 1 1 11/02/2009
    2 Depositos A.P.V.     Baring Europa 2 Baring Europa USD USD 2 1 1 11/02/2009

    As you can see, before the line of title, there are a few lines that are not supposed to be there.

    Thank you much in advance.

    You can find this more simple:

    CREATE OR REPLACE PROCEDURE DPR_CLOBTOFILE (
      P_FILENAME IN VARCHAR2
    , P_DIR IN VARCHAR2
    , P_CLOB IN CLOB
    )
    IS
    BEGIN
    
      dbms_xslprocessor.clob2file(p_clob, p_dir, p_filename);
    
    END;
    /
    
  • CLOB XML Parsing

    Hello

    I have a table containing the xmltype column that contains XML code. I want to read reviews and do the following

    1 insert records in the table that are present in < insert > < / insert > tag
    2 update records in the table that are present in < updated > < / update > tag
    3 delete records from table to present data in < delete > < / remove > tag


    Please find below the table and example of xml code.

    -------------------------------------------------------------------------------
    create table (ID XmlTest
    data_xml XMLType)
    CLOB XmlType data_xml STORE DID;

    insert into values of XmlTest (id, data_xml)
    (2
    XMLType ("< data >
    < Insert >
    < id > 101 < /ID > < name > John < / name >
    < id > 102 < /ID > < name > Adrian < / name >
    < id > 103 < /ID > < name > Kevin < / name >
    < / insert >
    < updated >
    < id > 1 < /ID > < name > Mary < / name >
    < code > 2 < /ID > < name > Arron < / name >
    < id > 3 < /ID > < name > Bret < / name >
    < / update >
    < remove >
    < id > 51 / < ID >
    < id > 52 / < ID >
    < id > 53 / < ID >
    < / delete >

    ((< / data > '));

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

    I cannot playback / analysis of the data available in each section (insert/update/delete).

    Best regards

    Fred

    Published by: user9043085 on 15 Sep, 2010 05:30

    Published by: user9043085 on 15 Sep, 2010 05:31

    Hi Fred,.

    Well, you changed the root node and added a default namespace, which complicates things... but not that much good :)

    Develop on A_Non post:

    select xmltest1.id,xmltest1.name
      from xmltest,
           XMLTABLE(
              XMLNamespaces(default 'syncpsna/schemas'),
              '/NATOPOLOGYSyncElementRequest/insert/row'
                    PASSING xmltest.data_xml
                    COLUMNS
                    "ID" number(10) PATH 'id',
                    "NAME" varchar2(50) PATH 'name') xmltest1
    where xmltest.id = 2;
    

    BTW, to validate the code in shape, you don't need an extra slash in the closing tag, simply use the same

     to enclose the section.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    
  • XML + CLOB

    Hello

    I do a mini-fonction to read a CLOB xml:

    create the table XmlTest of XmlType;

    DECLARE

    localXML ClOB;

    BEGIN

    localXML: = ' <? XML version = "1.0" encoding = "utf-8"? > < message >
    < Pippo id = "33" status = '0' / >
    < Pippo id = "34" status = "1" / >
    < id Pluto = "35" status = '0' / >
    < id Pluto = '36' status = "1" / >
    < Barcode id = "asfjhsfjkhwegjk22312312" status = '0' / >
    < Barcode id = "sdklfjosgkdfgh596895354" status = '0' / > < / messages > ';

    INSERT INTO XMLTEST VALUES (XMLTYPE (localXML));

    END;

    When I do:
    SELECT x.getCLobVal (XmlTest) x;

    The CLOB create a tag perfect for my job.

    So, I want to insert the id value and status in another table (id is a varchar2 and status is a number). Is possible?

    I use Oracle Database 10 g Enterprise Edition Release 10.2.0.4.0

    Thank you.

    Your Oracle client version must be incompatible with the server.

    Could check you?

  • How to read XML data stored as a Clob

    Hello
    I'm new on clob & XML types...
    Data XML has been inserted into a Clob field in a Table in Oracle (9.2.0.8.0)
    -----------------------------------------------------------
    CREATE THE TEMP TABLE
    (
    SNO NUMBER (5),
    STR_VAL LONG,
    CREATED_DT DATE default sysdate,
    COL2 CLOB,
    COL3 SYS. XMLTYPE
    )
    -----------------------------------------------------------
    SELECT dbms_lob.getlength (col2) of temp
    ---
    -> 24754
    -----------------------------------------------------------
    SQL > select temp col2;

    COL2
    ----------------------------------------------
    & lt; DataSet1 & gt;
    & lt; TAGSDATATABLE & gt;
    & lt; TAG_NAME & gt; KST20001 & lt; / TAG_NA
    --------------------------------------------------------------------------
    If I use the stmt above it shows only a pice of data


    How can I get the data in this column.

    could someone help to obtain the data.

    Concerning
    Prakash

    Published by: user12957183 on August 25, 2010 12:25 AM

    Insert data in to table XMLTYPE clob variable:

    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2  my_clob CLOB := 'KST20001
      3  KST20002
      4  KST20003
      5  
      6  KST20004
      7  
      8  
      9  KST20005
     10  
     11  
     12  KST20006
     13  
     14  
     15  KST20007
     16  
     17  
     18  KST20008
     19  
     20  
     21  KST20009
     22  
     23  
     24  KST20010
     25  
     26  
     27  KST20009
     28  
     29  ';
     31  BEGIN
     33  INSERT INTO my_tab1 VALUES(XMLTYPE(my_clob));
     34* end;
    SQL> /
    
    PL/SQL procedure successfully completed.
    
    SQL> desc my_tab1;
     Name
     ---------------------------------------------------------------------------------------------------
     TABLE of XMLTYPE
    
    SQL> 
    
    -- For larger data:
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2  my_clob CLOB := '
      3  
      4  KST20001
      5  
      6  
      7  KST20002
      8  
      9  
     10  KST20003
     11  
     12  
     13  KST20004
     14  
     15  
     16  KST20005
     17  
     18  
     19  KST20006
     20  
     21  
     22  KST20007
     23  
     24  
     25  KST20008
     26  
     27  
     28  KST20009
     29  
     30  
     31  KST20010
     32  
     33  
     34  KST20009
     35  
     36  
     37  KST20009
     38  
     39  
     40  KST20009
     41  
     42  
     43  KST20009
     44  
     45  
     46  KST20010
     47  
     48  
     49  KST20009
     50  
     51  
     52  KST20009
     53  
     54  
     55  KST20009
     56  
     57  
     58  KST20009
     59  
     60  
     61  KST20010
     62  
     63  
     64  KST20009
     65  
     66  
     67  KST20009
     68  
     69  
     70  KST20009
     71  
     72  
     73  KST20009
     74  
     75  
     76  KST20010
     77  
     78  
     79  KST20009
     80  
     81  
     82  KST20009
     83  
     84  
     85  KST20009
     86  
     87  
     88  KST20009
     89  
     90  
     91  KST20010
     92  
     93  
     94  KST20009
     95  
     96  
     97  KST20009
     98  
     99  
    100  KST20009
    101  
    102  
    103  KST20009
    104  
    105  
    106  KST20010
    107  
    108  
    109  KST20009
    110  
    111  
    112  KST20009
    113  
    114  
    115  KST20009
    116  
    117  
    118  KST20009
    119  
    120  
    121  KST20010
    122  
    123  
    124  KST20009
    125  
    126  
    127  KST20009
    128  
    129  
    130  KST20009
    131  
    132  
    133  KST20009
    134  
    135  
    136  KST20010
    137  
    138  
    139  KST20009
    140  
    141  
    142  KST20009
    143  
    144  
    145  KST20009
    146  
    147  ';
    148  l_xmltype xmltype;
    149  BEGIN
    150  --l_xmltype := my_clob;
    151  INSERT INTO my_tab1 VALUES(XMLTYPE(my_clob));
    152* end;
    SQL> /
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    Published by: AP on August 25, 2010 04:46

  • Literal string too long for the CLOB

    Hello
    My version of the database is:
    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE 11.2.0.1.0 Production
    AMT for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

    When I run this piece of code, I get an error.
    DECLARE
    insCtx DBMS_XMLStore.ctxType;
    lines NUMBER;
    xmlDoc CLOB: = 'xml string is about 4600 long lines in TOAD...';
    BEGIN
    insCtx: = DBMS_XMLStore.newContext ("xmlTempTbl"); -get the context
    lines: = DBMS_XMLStore.insertXML (insCtx, xmlDoc); -Insert the doc
    DBMS_XMLStore.closeContext (insCtx); -close the handle
    END;

    ERROR:
    ORA-06550: line 4, column 19:
    PLS-00172: string literal too long

    From my understanding a CLOB leave maximum string size of 2 GB. And on top, my xml string is not greater than 2 GB (I cannot display the xml data string, refers to the business). So why I get the error too long string literal.
    For the above, I fault the XML into several parts and run the PLSQL, then it gives no error.
    Please advice.

    Published by: 934451 on November 8, 2012 07:06

    Published by: 934451 on November 8, 2012 07:07

    From my understanding a CLOB leave maximum string size of 2 GB.

    Not exactly:
    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e25519/datatypes.htm#CHDDCGEE

    but this isn't the real problem.

    The error is about the "string literal" size, there is a limitation too:
    http://docs.Oracle.com/CD/E11882_01/server.112/e17766/pcmus.htm#sthref18132

    PLS-00172: string literal too long
        Cause: The string literal was longer than 32767 bytes.
        Action: Use a string literal of at most 32767 bytes.
    

    For the above, I fault the XML into several parts and run the PLSQL, then it gives no error.

    Is this a real case of production or you just test?
    In practice, we should first save the file in a variable/column CLOB (or XMLType) and then reference the content from there.

  • I'm a DBA. I want to learn XML?

    I'm an Oracle DBA(10gR2,11G) working for a team of application development. I don't know anything about the XML data. All I know is that XML files are stored in the CLOB columns.

    Should I learn XML? How XML knowledge will strengthen the capacity of an Oracle DBA?

    Various projects, I have the impression that DBA a developers should learn as much as possible on the XML data.

    For a DBA can cause focusing on parts of the administration and storage, while a developer might focus on the part of the use and interpretation.

    Here are some topics that might be of particular interest to a DBA.

    with no particular order
    -Storage of XMLTYPE
    -Only XMLTYPE tables
    -Use of XML schemas
    -XMl Schema evolution (how to manage the change in the XML schemas that are forced into an XMLTYPE column).
    -memory CLOB, XML secure secure
    -the XML output file system
    -SQL - XML, XPATH
    ...

    For a developer
    -XPATH, XQUERY, XML - SQL
    -Analysis of XML (DOM / SAX parser)
    XSL/XSLT
    -Printing XML (XML - FO, Apache Fop, etc..)
    -XML relational mapping using views
    -extract, extractvalue
    -AppendXml, InsertXml, UpdateXml (not sure on the correct method names)
    ...

    Published by: Sven w. on August 31, 2009 13:42

  • Error in expdp

    Hello

    I'm trying to export a schema with 2 tables with the CLOB (XML file stored) data type. While the expdp am getting error below.

    ORA-39097: Data Pump job encountered the error unexpected-12801

    ORA-39065: exception unexpected master process in HAND

    ORA-12801: error reported in the PZ99, instance XXXXXX parallel query server

    ORA-01460: dead letter or unreasonable conversion requested

    Job 'XXXXXXXX '. "" SYS_EXPORT_SCHEMA_01 "stopped because of the mistake at 03:46:32

    already my parameter PARALLEL_DEGREE_POLICY value is MANUAL. Help, please

    The error that you get a little weird, so if I were you, and if the error is reproducible, I would trace your datapump for more information.  You could follow the datapump job Oracle sessions or add "trace = 1FF0300" to the command line expdp; This will create tracking in your folder of trace files.  Search for 'trace = 1FF0300' to find out how it works.

  • createRowFromResultSet not called for the first row

    Hi all

    Jdev Version: 11.1.1.7.0

    I have a XML stored in DB as a CLOB. I get this as a CLOB XML file (via clobdomain) in my VO and will fill some other transient attributes. I tried to do this by substituting (according to the ticket) method 'createRowFromResultSet'. I observe a strange behavior that this method does not get invoked at the first line only.

    Earlier, I see someone else suffer from a similar problem - discussion thread. Is this a bug that appears when you use clob and the override of this method?

    Thanks in advance,

    Srini

    Noted bug with Jdev team for this that I was able to reproduce the problem. Once I have remove the CLOB to the VO, he begins to work!.

  • Saving UTL_FILE of Oracle 9i DataBase

    Hi all!

    I have a problen save an XML file that is generated in the SQL sentence in my Oracle 9i Database when the file is greater than 32 KB.

    To save the file that I use UTL_FILE library and I found that there is the problem.

    The code I use is as follows:

    CREATE OR REPLACE PROCEDURE SIGADMIN. PRUEBA_CAUC0004_EXT AUTHID CURRENT_USER IS
    CLOB XML;
    VXML varchar2 (100);
    ..
    ..
    xfile utl_file.file_type;
    doc xmldom. DOMDocument;
    ..
    ..
    BEGIN
    ..
    ..

    -Inicializamos el CLOB
    DBMS_LOB. CreateTemporary (xml, TRUE);
    ..
    ..

    -Pasar el DOM document a CLOB
    xmldom.writeToClob (doc, xml);

    xfile: = utl_file.fopen('TEMP_DIR','PRUEBA_CAUC0004.xml','w');
    ..
    ..
    WHILE (pos, len) LOOP
    VXML: = dbms_lob.substr(xml,100,pos);
    UTL_FILE.put (xfile, VXML);

    POS: = pos + 100;
    END OF LOOP
    -Liberamos los recursos
    xmldom.freeDocument (doc);
    UTL_FILE.fclose (x);
    ..
    ..
    ..

    In general, it is much easier to use"dbms_xslprocessor.clob2file" as shown in the following pseudocode:

    declare
       xml xmltype;
       cl   clob;
    begin
       xml := build_your_xml();
       cl := convert_xml_to_clob(xml);
       dbms_xslprocessor.clob2file (cl, 'YOUR_DIRECTORY', 'YOUR_FILENAME');
    end;
    /
    
  • Update an attribute XML in a CLOB to a table column

    Hello world

    I have a CLOB column in my table that carries a date XML. In which I need to update the attributes of the child when they repeat with the same parents several times in the data.

    For example:

    Say my XML data as follows.

    <? XML version = "1.0"? >

    " < sample xmlns =" https://www.ABC.com "> "

    < a > < b > detail first line < /b >

    second line of detail/< c >/< c >

    < /a >

    < d > < c > Paris/< c > < / d >

    < d > < c > France/< c > < / d >

    Japan < d > < c >/< c > < / d >

    < /sample >


    I want to update as

    <? XML version = "1.0"? >

    < sample xmlns = " https://www.ABC.com "> "

    < a > < b > detail first line < /b >

    second line of detail/< c >/< c >

    < /a >

    < d > < c1 > Paris < / c1 > < / d >

    < d > < c2 > France < / c2 > < / d >

    Japan < d > < c3 > < / c3 > < / d >

    < /sample >


    I have tried to identify the repetition of my parent attribute using the sub query and I tried updating their attribute by extracting the XML data for each attribute parent in a loop. But it does not work


    Select xml_load where xml_name = "sample1"; regexp_count (xml_val,' <d> ') -Giving more than 10K as County


    Identified the attributes of the parent for help,

    Select

    Count (1)

    of xml_load x

    where existsNode (extract (xmltype (xml_val),'/ * [local - name () = "sample"]'),)

    (' / d ') = 1 - he never returned me 1. I couldn't understand why as there is an attribute called < d >.

    Please provide your help in achieving my requirement. Any help would be greatly appreciated.

    I guess you want to insert an attribute in the existing xml document. So my suggestion is, instead of UPDATEXML you can just use INSERTCHILDXML. The following code works correctly. Hope this will be the final XML format

    -Code

    DECLARE

    l_col1 XMLTYPE.

    Nt_xml TYPE TABLE IS NUMBER;

    l_ntxml nt_xml: = nt_xml();

    BEGIN

    XMLTYPE (xt.xml_val) SELECT col1 INTO l_col1

    OF xml_test xt

    WHERE xt.xml_name = 'file sample.xml ";

    SOME pos

    LOOSE COLLECTION l_ntxml

    OF xml_test xt.

    XMLTABLE (xmlnamespaces (DEFAULT "http://www.abc.com'),

    "/ Report/identifier/area/CodeCategory.

    PASSAGE xmltype (xt.xml_val)

    COLUMNS pos for ORDINALITE

    )

    WHERE xt.xml_name = 'file sample.xml ";

    BECAUSE me IN 1.l_ntxml. COUNTY

    LOOP

    SELECT INSERTCHILDXML (l_col1,'/ report/identifier/area/CodeCategory ['| l_ntxml (i) |'] /Code','@id',l_ntxml (i) ','xmlns = "http://www.abc.com" ' ")

    IN l_col1

    DOUBLE;

    END LOOP;

    -DBMS_OUTPUT. Put_line (l_col1. GetClobVal());

    UPDATE xml_test SET xml_val is l_col1. GetClobVal() WHERE xml_name = "sample.xml";

    COMMIT;

    END;

    -After insertion

    http://www.ABC.com">

    CC5

    I48c2

    5

    65445

    5

    2c653

    5

    4c28

    5A

    55635

    5

    I5cc

    5

    65645

    5

    4555

    2

    I483

    5

    e558

    5

    I482

    5

    5563c

    5

    76526

    5

    64885

    2

    76524

    5

    e55c

    5

    e556c

    5

    C5cc52

    5

    45c7c

    2

    45c75

    2

    2c64c

    2

    77585

    5

    65455

    5

    e5565

    5

    2c644

    2

    667c2

    5

    2c643

    5

    7655c

    5

    O8c

    5

    V3cc5

    2

    V3ccc

    3

    73c27

    5

    3c4cc

    5

    24c7c

    5

    V275

    5

    V27c

    5

    e25

    5

    e5cc

    5

    76556

    5

    64825

    2

    2c57c

    5

    252c5

    5

    75cc

    5

    V5867

    2

    4c32c

    5

    25c8c

    5

    C5c555

    5

    V245

    5

    V242

    3

    2c75

    5

    65665

    5

    J452c

    5

    765c3

    5

    252cc

    5

    34545

    5

    555

    5

    4c4c

    5

    64855

    5

    I27c

    5

    F84c

    5

    27735

    5

    25cc3

    2

    27cc

    2

    556c

    5

    I5c32

    5

    3c4c5

    5

    25ccc

    54

    585

    5

    25cc2

    5

    25cc5

    5

    648c5

    2

    64425

    5

    3c4cc

    5

    O42c2

    5

    65c65

    5

    77c3

    5

    77c7

    5

    Pc735

    5

    27c4

    5

    c38c

    5

    J45cc8

    5

    2c68c

    5

    cc5c5

    5

    343c

    5

    2c68c

    2

    4c3c5

    5

    57c3

    5

    4c3c2

    2

    e37c

    5

    Mc57c

    5

    4c3cc

    8

    57cc

    5

    42735

    4

    42732

    2

    345c5

    5

    O6c85Xc

    5

    4283c

    5

    2c8c

    5

    25c6c

    3

    ec42

    5

    25c62

    5

    25c63

    5

    4568

    5

    345cc

    5

    2c632

    4

    65425

    3

    2c63c

    2

    5745

    5

    2c635

    5

    F3553

    5

    754c

    4

    45c85

    5

    78c3c

    3

    5748

    5

    73cc7

    5

    76c

    5

    66455

    5

    657c5

    5

    66cc5

    5

    V42c

    2

    V425

    5

    7767

    5

    66624

    5

    42822

    5

    57c8

    5

    Mc54c

    5

    2c634

    5

    e7c4

    5

    J845c

    5

    2c62c

    5

    45cc5

    2

    2c622

    5

    64765

    5

    e554c

    5

    3572

    3

    e3c2

    5

    5c6c

    5

    73c5c

    5

    7467

    5

    V426

    5

    65c

    3

    7463

    5

    F35c

    5

    64664

    5

    7464

    5

    73c57

    5

    c383

    5

    4c5c

    5

    66652

    5

    F5525

    5

    F552c

    5

    25c4c

    5

    2c626

    5

    428c

    2

    65225

    5

  • How to extract a value of sql xml column clob data

    Hi guys,.

    I need help with the following. I have a column with data type xml (clob data). I need to extract the information in the < RI4 > tag and the < RI6 > tag.
    I truncated the data, but there is a repetition of the < RI4 > tag and consequenty internal to that tag RI6. However, each tag RI4 and RI6 has different data.

    I would be grateful if you can help me with this:

    <a xsi:schemaLocation="som location.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:somlocation">
      <b>Some stuff here</b>
      <c>
      <someinfo>blah</someinfo>
      <someinfo2>blah2</someinfo2>
      </c>
      <EffectiveDateTime>2015-10-01T00:00:00+10:00</EffectiveDateTime>
      <CurrencyCode>AUD</CurrencyCode>
      <RequiredInformation>
      <RequiredInformation2>
      <RequiredInformation3>
      <RI4>someinfo</RI4>
      <RI5>
      <RI6>
      <a1>1</a1>
      <b1>9.13</b1>
      </RI6>
      <RI6>
      <a1>2</a1>
      <b1>8.75</b1>
      </RI6>
      <RI6>
      <a1>3</a1>
      <b1>78.90</b1>
      </RI6>
      <RI6>
      <a1>4</a1>
      <b1>200</b1>
      </RI6>
      <RI6>
      <a1>5</a1>
      <b1>17.59</b1>
      </RI6>
      </RI5>
      </RequiredInformation3>
      </RequiredInformation2>
      </RequiredInformation>
      </a>
    

    I think that since it's the repetition I might need to make some sort of PL/SQL programming, but I really need help here to build this announcement also a way to extract the information.

    Any help would be greatly appreciated.

    Kind regards

    You can parse your XML like this

    SQL> with t
      2  as
      3  (
      4  select
      5  '
      6      Some stuff here
      7      
      8          blah
      9          blah2
     10      
     11      2015-10-01T00:00:00+10:00
     12      AUD
     13      
     14          
     15              
     16                  someinfo
     17                  
     18                      
     19                          1
     20                          9.13
     21                      
     22                      
     23                          2
     24                          8.75
     25                      
     26                      
     27                          3
     28                          78.90
     29                      
     30                      
     31                          4
     32                          200
     33                      
     34                      
     35                          5
     36                          17.59
     37                      
     38                  
     39              
     40          
     41      
     42  ' xml_str
     43    from dual
     44   )
     45  select t1.ri4, t2.a1, t2.b1
     46    from t
     47       , xmltable
     48         (
     49            xmlnamespaces(default 'urn:somlocation', 'http://www.w3.org/2001/XMLSchema-instance' as "xsi")
     50         ,  '/a/RequiredInformation/RequiredInformation2/RequiredInformation3' passing xmltype(t.xml_str)
     51            columns
     52               ri4 varchar2(10) path 'RI4'
     53             , ri5 xmltype path 'RI5'
     54         ) t1
     55       , xmltable
     56         (
     57            xmlnamespaces(default 'urn:somlocation')
     58          , '/RI5/RI6' passing t1.ri5
     59            columns
     60               a1 number path 'a1'
     61             , b1 number path 'b1'
     62         ) t2;
    
    RI4                A1         B1
    ---------- ---------- ----------
    someinfo            1       9.13
    someinfo            2       8.75
    someinfo            3       78.9
    someinfo            4        200
    someinfo            5      17.59
    
    SQL>
    
  • Ask the CLOB and out of model xml - EBS R12.1.3

    Hi all

    Due to a limitation in the module IBY, we are unable to produce a file for the receivables credit institutions.

    The data that we want are stored in the table IBY_XML_ONLINE_FCI_1_0_V via a CLOB. There is a TRXNMID column that we would then have to query to get the good deal.

    Our thoughts are now report(XDODTEXE style) we create an xml model, so they can run a simultaneous program and generate a file according to the model of etext.

    We have the required format of installation already as a model of etext.

    Is there a way to create the definition of data, so it can pickup the column / the CLOB field and have the extext generates output?

    Or does anyone know a better way to do this?

    See you soon,.

    Russell H.

    Focus on the following document on how to treat the CLOB data:

    • Doc-ID 1560000.1 R12: Tags XML type column CLOB xmldata become & lt and & gt in the exit of BI Publisher model
  • Insert the string xml in a clob column. ??

    https://drive.Google.com/file/d/0BwAVQqYmX0-zMHZiS1F0SVdOMmc/view?USP=sharing

    DECLARE
            v_clob CLOB := to_clob('xml string from local file'); --pls. download xml file from above url;
            stmt NVARCHAR2(500) := 'INSERT INTO TEST(XMLDATA) VALUES(:x)';
    BEGIN
            EXECUTE IMMEDIATE stmt USING v_clob;
    END;
    

    If I use xmltype so I can use XMLType (bfilename ('test_dir', '"Data.xml" '), nls_charset_id ('AL32UTF8'))

    but I have to use clob for storing the xml string. because oracle xmltype cannot correctly parse these xml data. ;

    Google search for 'oracle insert clob from the file' would you find this answer fairly quickly.

    You don't need to use dynamic sql statements.

  • ORA-03113 "reading" XML of CLOB

    Hello

    I use XMLTable for reading XML to insert data into the DB table. I have:

    PROCEDURE IMPORT_XML)

    p_plik VARCHAR2,

    p_tp_id NUMBER,

    number of p_commit_po: = 500) IS

    l_blob_id TERYT_PLIKI.tp_blob_id%type;

    l_blob BLOB;

    XMLTYpe l_teryt_xml;

    L_Name varchar2 (100);

    l_type varchar2 (100);

    l_date varchar2 (100);

    -l_part varchar2 (100);

    XMLType l_rows;

    l_commit number (6);

    l_cnt_rows NUMBER: = 0;

    procedure do_commit is

    Start

    l_commit: = l_commit + 1;

    l_cnt_rows: = l_cnt_rows + 1;

    If l_commit > = p_commit_po then

    commit;

    l_commit: = 0;

    end if;

    end do_commit;

    BEGIN

    -# variable l_BLOB contains BLOB from a column of table #.

    Err.d ("convert BLOB CLOB type...', 'IMPORT_XML', 70 ');

    declare

    dest_lob CLOB.

    src_lob BLOB;

    the sum integer: = DBMS_LOB. LOBMAXSIZE;

    dest_offset integer: = 1;

    offset integer: = 1;

    number of blob_csid: = nls_charset_id ('AL32UTF8');

    lang_context integer: = 0;

    the warning integer: = DBMS_LOB. WARN_INCONVERTIBLE_CHAR;

    Start

    dest_lob: = empty_Clob();

    DBMS_LOB. CREATETEMPORARY (dest_lob, false);

    DBMS_LOB. OPEN (dest_lob, DBMS_LOB. LOB_READWRITE);

    DBMS_LOB. OPEN (l_blob, DBMS_LOB. LOB_READONLY);

    DBMS_LOB. () CONVERTTOCLOB

    dest_lob,

    l_blob,

    amount,

    dest_offset,

    offset,

    blob_csid,

    lang_context,

    (caveat);

    DBMS_LOB. Close (l_blob);

    l_teryt_xml: = XMLType (dest_lob);

    commit;

    DBMS_LOB. FREETEMPORARY (dest_lob);

    end;

    l_rows: = l_teryt_xml.extract('/teryt/catalog/row');

    l_commit: = 0;

    If l_name = "TERC" then

    Err.d ("name =" |) L_Name, cm, 80);

    for r in (SELECT x.*

    FROM XMLTable ('/ rank ' ADOPTION l_rows)

    ["COLUMNS"WOJ"PATH of the VARCHAR2 (20) ' col[@name="WOJ "]',

    ["VARCHAR2 (20)"POW"PATH" col[@name="POW"]',

    ["Path"GMI"VARCHAR2 (20) ' col[@name="GMI "]',

    PATH of VARCHAR2 (2) "RODZ" "col[@name="RODZ"]',"

    PATH of VARCHAR2 (50) "NAME" "col[@name="NAZWA"]',"

    PATH of VARCHAR2 (50) "NAZDOD" "col[@name="NAZDOD"]',"

    "[" "STAN_NA PATH" VARCHAR2 (10) ' col[@name="STAN_NA"] "

    ) x

    ) loop

    INSERT INTO TERYT_TERC (WOJ, POW, GMI, RODZ, NAME, NAZDOD, STAN_NA, TP_ID)

    VALUES (r.WOJ, r.POW, r.GMI, r.RODZ, r.NAZWA, r.NAZDOD, r.STAN_NA, P_TP_ID);

    do_commit;

    end loop;

    elsif l_name = "SIMC" then

    Err.d ("name =" |) L_Name, cm, 80);

    for r in (SELECT x.*

    FROM XMLTable ('/ rank ' ADOPTION l_rows)

    "WOJ" VARCHAR2 COLUMNS (3) path "col[@name="WOJ"]',"

    ["" POW"VARCHAR2 (3) path" col[@name="POW"]',

    "GMI" VARCHAR2 (3) PATH "col[@name="GMI"]',"

    PATH of VARCHAR2 (2) "RODZ_GMI" "col[@name="RODZ_GMI"]',"

    ["" RM"VARCHAR2 (3) path" col[@name="RM"]',

    "MZ' VARCHAR2 (3) PATH" col[@name="MZ"]', "

    PATH of VARCHAR2 (60) "NAME" "col[@name="NAZWA"]',"

    "SYM' VARCHAR2 (7) PATH" col[@name="SYM"]', "

    PATH of VARCHAR2 (7) "SYMPOD" "col[@name="SYMPOD"]',"

    PATH of VARCHAR2 (10) "STAN_NA" "col[@name="STAN_NA"]"

    ) x

    ) loop

    INSERT INTO TERYT_SIMC (WOJ, POW, GMI, RODZ_GMI, RM, MZ, NAME, SYMBOL, SYMPOD, STAN_NA, TP_ID)

    VALUES (r.WOJ, r.POW, r.GMI, r.RODZ_GMI, r.RM, r.MZ, r.NAZWA, r.SYM, r.SYMPOD, r.STAN_NA, P_TP_ID);

    do_commit;

    end loop;

    elsif l_name = "ULIC" then

    Err.d ("name =" |) L_Name, cm, 80);

    for r in (SELECT x.*

    FROM XMLTable ('/ rank ' ADOPTION l_rows)

    "WOJ" VARCHAR2 COLUMNS (3) path "col[@name="WOJ"]',"

    ["" POW"VARCHAR2 (3) path" col[@name="POW"]',

    "GMI" VARCHAR2 (3) PATH "col[@name="GMI"]',"

    PATH of VARCHAR2 (2) "RODZ_GMI" "col[@name="RODZ_GMI"]',"

    "SYM' VARCHAR2 (7) PATH" col[@name="SYM"]', "

    PATH of VARCHAR2 (7) "SYM_UL" "col[@name="SYM_UL"]',"

    PATH of VARCHAR2 (5) "CECHA" "col[@name="CECHA"]',"

    PATH of VARCHAR2 (50) "NAZWA_1" "col[@name="NAZWA_1"]',"

    PATH of VARCHAR2 (50) "NAZWA_2" "col[@name="NAZWA_2"]',"

    PATH of VARCHAR2 (10) "STAN_NA" "col[@name="STAN_NA"]"

    ) x

    ) loop

    INSERT INTO TERYT_ULIC (WOJ, POW, GMI, RODZ_GMI, SYM, SYM_UL, CECHA, NAZWA_1, NAZWA_2, STAN_NA, TP_ID)

    VALUES (r.WOJ, r.POW, r.GMI, r.RODZ_GMI, r.SYM, r.SYM_UL, r.CECHA, r.NAZWA_1, r.NAZWA_2, r.STAN_NA, P_TP_ID);

    do_commit;

    end loop;

    elsif l_name = "WMRODZ" then

    Err.d ("name =" |) L_Name, cm, 80);

    for r in (SELECT x.*

    FROM XMLTable ('/ rank ' ADOPTION l_rows)

    "RM" VARCHAR2 COLUMNS (5) path "col[@name="RM"]',"

    PATH of VARCHAR2 (50) "NAZWA_RM" "col[@name="NAZWA_RM"]',"

    PATH of VARCHAR2 (10) "STAN_NA" "col[@name="STAN_NA"]"

    ) x

    ) loop

    INSERT INTO TERYT_WMRODZ (RM, NAZWA_RM, STAN_NA, TP_ID)

    VALUES (r.RM, r.NAZWA_RM, r.STAN_NA, P_TP_ID);

    do_commit;

    end loop;

    end if;

    validation work;


    When I'm loading file of type "SIMC" (the file size is approximately 32 MB), all right.

    When I am trying to load the "NEW" type (size file is about 80 MB), there's an ORA-03113.


    The problem is with the LOOP SELECTION, because

    Err.d ("name =" |) L_Name, cm, 80);

    connects name = ULIC


    What can I do to fix this?

    My DB is: Oracle Database 11 g Release 11.2.0.4.0 - 64 bit Production

    As Jason said, there are a bunch of useless stuff in there:

    -The VALIDATION inside the loop: do not do, commit only once, after that the job is done.

    -FOR lines: do not do this, use only one (possibly multi-table) INSERT SELECT.

    -BLOB CLOB conversion: not necessary, use the XMLTYPE constructor.

    -Extract from the XML document, that the work of the intermediate parties do in the whole structure directly.

    Basically, your procedure can be simplified to this couple of statements:

    -- insert XML into a temporary binary XMLType table, for performance :
    insert into tmp_xml values ( xmltype(l_blob, nls_charset_id('AL32UTF8')) );
    
    -- multitable insert into the target tables :
    INSERT FIRST
    WHEN l_name = 'TERC' THEN INTO
      TERYT_TERC (WOJ, POW, GMI, RODZ, NAZWA, NAZDOD, STAN_NA, TP_ID)
      VALUES (WOJ, POW, GMI, RODZ, NAZWA, NAZDOD, STAN_NA, P_TP_ID)
    WHEN l_name = 'SIMC' THEN INTO
      TERYT_SIMC (WOJ, POW, GMI, RODZ_GMI, RM, MZ, NAZWA, SYM, SYMPOD, STAN_NA, TP_ID)
      VALUES (WOJ, POW, GMI, RODZ_GMI, RM, MZ, NAZWA, SYM, SYMPOD, STAN_NA, P_TP_ID)
    WHEN l_name = 'ULIC' THEN INTO
      TERYT_ULIC (WOJ, POW, GMI, RODZ_GMI, SYM, SYM_UL, CECHA, NAZWA_1, NAZWA_2, STAN_NA, TP_ID)
      VALUES (WOJ, POW, GMI, RODZ_GMI, SYM, SYM_UL, CECHA, NAZWA_1, NAZWA_2, STAN_NA, P_TP_ID)
    WHEN l_name = 'WMRODZ' THEN INTO
      TERYT_WMRODZ (RM, NAZWA_RM, STAN_NA, TP_ID)
      VALUES (RM, NAZWA_RM, STAN_NA, P_TP_ID)
    SELECT x.*
    FROM tmp_xml t
       , XMLTable('/teryt/catalog/row'
           PASSING t.object_value
           COLUMNS "WOJ"      VARCHAR2(20) PATH 'col[@name="WOJ"]',
                   "POW"      VARCHAR2(20) PATH 'col[@name="POW"]',
                   "GMI"      VARCHAR2(20) PATH 'col[@name="GMI"]',
                   "RODZ"     VARCHAR2(2)  PATH 'col[@name="RODZ"]',
                   "NAZWA"    VARCHAR2(50) PATH 'col[@name="NAZWA"]',
                   "NAZDOD"   VARCHAR2(50) PATH 'col[@name="NAZDOD"]',
                   "STAN_NA"  VARCHAR2(10) PATH 'col[@name="STAN_NA"]',
                   "RODZ_GMI" VARCHAR2(2)  PATH 'col[@name="RODZ_GMI"]',
                   "RM"       VARCHAR2(3)  PATH 'col[@name="RM"]',
                   "MZ"       VARCHAR2(3)  PATH 'col[@name="MZ"]',
                   "SYM"      VARCHAR2(7)  PATH 'col[@name="SYM"]',
                   "SYMPOD"   VARCHAR2(7)  PATH 'col[@name="SYMPOD"]',
                   "SYM"      VARCHAR2(7)  PATH 'col[@name="SYM"]',
                   "SYM_UL"   VARCHAR2(7)  PATH 'col[@name="SYM_UL"]',
                   "CECHA"    VARCHAR2(5)  PATH 'col[@name="CECHA"]',
                   "NAZWA_1"  VARCHAR2(50) PATH 'col[@name="NAZWA_1"]',
                   "NAZWA_2"  VARCHAR2(50) PATH 'col[@name="NAZWA_2"]',
                   "NAZWA_RM" VARCHAR2(50) PATH 'col[@name="NAZWA_RM"]'
         ) x
    ;
    

    where TMP_XML is defined as follows:

    create global temporary table tmp_xml of xmltype
    xmltype store as securefile binary xml;
    

Maybe you are looking for