DBMS_XMLStore

hi,
i am insert XML file into table using DBMS_XMLStore package where as one xml file compare with xsl file using below statement
DBMS_XMLStore.insertXML(v_context_CI, XMLType.transform(CI_XmlFile_data, xsl_data_CI));
but i am facing error like :
ORA-30625: method dispatch on NULL SELF argument is disallowed
i am not able to find out the reason for this error. please help me
Regards,
Madan

Code details:
CREATE OR REPLACE PROCEDURE Proc_XMLtoTable( P_CI_XmlFile IN clob ) AS
v_context_CI DBMS_XMLStore.ctxType;
v_rows NUMBER;
CI_XmlFile_data xmltype := xmltype(P_CI_XmlFile); --input XML File
xsl_data_CI xmltype ; -- xsl file
xsl_tab_CI varchar2(100); -- Table
BEGIN
--fetching xsl file and table name from table
select xsl_text,tab_name into xsl_data_CI,xsl_tab_CI from Xsl_data where xsl_id= 1;
--Open a new context for creditor_invoices
v_context_CI := DBMS_XMLStore.newContext(xsl_tab_CI); --table name stored in xsl_tab_CI
v_rows := DBMS_XMLStore.insertXML(v_context_CI, XMLType.transform(CI_XmlFile_data, xsl_data_CI));
---- Close the creditor_invoices context
DBMS_XMLStore.closeContext(v_context_CI);
end;
the input is xML file and it is compare with XSL file fetching from table Xsl_data into xsl_data_CI. XML file compare with xsl file using
XMLType.transform(CI_XmlFile_data, xsl_data_CI)
but it showing above mention error.

Similar Messages

  • White space handling dbms_xmlstore.insertxml

    Hi,
    I have a question about white space handling.
    I have a column in table which holds white space character.
    When I loading xml file using dbms_xmlstore.insertxml white space is converted into NULL and inserted into table.
    It would fail if the column type is not null.
    How do I handle it?
    ======================================================
    Alternatively, how do I insert a tag with only whitespace in it into a table?
    <Tag> </Tag> [One whitespace]
    To elaborate the question
    If I have following data in xml file ...
    =============================================
    <Rowset>
    <Row>
    <Tag1> </Tag1>
    <Tag2>1</Tag1>
    </Row>
    </Rowset>
    I have to load this data into
    table tab1...
    create table tab1 (tag1 varchar2(5), tag2 number);
    How do I achieve it using dbms_xmlstore so that I can read the whitespace in XML and load it correctly into the table?
    ========================================================================
    To use an alternate approach, I also tried the following.....
    I tried the following test program on the xml file also shown below....
    XML File is
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
    <SYS_NAME> a </SYS_NAME>
    <SYS_SERIAL_NUM>000000</SYS_SERIAL_NUM>
    </ROW>
    </ROWSET>
    And small procedure is
    create or replace procedure PRO_TEST
    as
    o_sys_name varchar(10);
    spacetag varchar2(10) := ' ';
    begin
    --execute immediate 'create global temporary table gt_xmltype_tab1 (xmlfile1 xmltype)';
    insert into gt_xmltype_tab(xmlfile1)
    values(XMLType(bfilename('RESTOREDIR','ADTL_SETUP_OPTIONS.xml'),nls_charset_id('AL32UTF8')));
    select extractvalue (value(x), '/ROW/SYS_NAME')
    into o_sys_name
    from gt_xmltype_tab gt, TABLE(XMLSequence(extract(gt.xmlfile1, '/ROWSET/ROW'))) x;
    dbms_output.put_line('[' || o_sys_name || ']');
    dbms_output.put_line('ASCII:- ' || ascii(o_sys_name));
    if o_sys_name = ' ' then
    --if o_sys_name = chr(32) then
    dbms_output.put_line('I found space');
    else
    dbms_output.put_line('I found no space');
    end if;
    commit;
    end;
    When Tag is <sys_nam> </sys_name> I get [] in the output(empty).
    When Tag is <sys_nam> a</sys_name> I get [ a] in the output(space and a).
    When Tag is <sys_nam> a </sys_name> I get [ a ] in the output(space a space).
    When I has some character along with the whitespace, behaviour is correct and as expected.
    But when the tag contains only whitespace the output is empty.
    I cant seem to get around this problem.
    Upon receiving empty string, other sub systems which are reading the data stop working.
    Can someone help here?
    Edited by: userAtoZ on May 14, 2011 2:57 PM

    White space handling dbms_xmlstore.insertxmlYou may replace all whitespaces with its corresponding html entity:
    SQL> create table test (v varchar2 (5))
    Table created.
    SQL> declare
      ctx   sys.dbms_xmlstore.ctxtype := dbms_xmlstore.newcontext ('test');
      doc   xmltype := xmltype(replace('<ROW><V> </V></ROW>',' ', '&#38;#32;'));
      ret   int;
    begin
      ret := dbms_xmlstore.insertxml (ctx, doc);
      dbms_xmlstore.closecontext (ctx);
    end;
    PL/SQL procedure successfully completed.
    SQL> select v, length (v), ascii(v) from test
    V             LENGTH(V)        ASCII(V)
                          1              32
    1 row selected.

  • Error using DBMS_XMLSTORE

    I am trying to use DBMS_XMLSTORE for inserting and updating an XML Table but I get error ORA-19200: Invalid column specification.
    This is the procedure I am using:
    procedure xml_insert_operation
    is
    myClob CLOB :=
    <operazione.log xmlns="http://www.hp.com/best/next/trx"
                        xmlns:xdb="http://xmlns.oracle.com/xdb"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xsi:schemaLocation="http://www.hp.com/best/next/trx operazione.log.xsd">
         <Operazione>Text</Operazione>
         <Journal>
              <NumeroElettronico>9900000000</NumeroElettronico>
              <CodiceFiliale>FIL01</CodiceFiliale>
              <CausaleOperazione>21</CausaleOperazione>
              <Inizio>2001-12-17T09:30:47</Inizio>
              <Termine>2001-12-17T09:30:47</Termine>
              <DescOperazione>Bonifico</DescOperazione>
              <Importo>1000.10</Importo>
              <Operatore>Relli</Operatore>
              <Status>OPERAZIONE_PRESA_IN_CARICO</Status>
              <DescErrore>String</DescErrore>
         </Journal>
    </operazione.log>';
    savCtx DBMS_XMLSTORE.ctxType;
    v_rows NUMBER;
    begin
    -- Save the content
    savCtx := DBMS_XMLSTORE.newContext('XMT_OPERAZIONE_LOG');
    DBMS_XMLSTORE.Setrowtag(savCtx,'operazione.log');
    -- Set the update columns to improve performance
    --DBMS_XMLSTORE.SetUpdateColumn (savCtx, 'Operazione');
    --DBMS_XMLSTORE.SetUpdateColumn (savCtx, 'Journal');
    -- Insert the document
    v_rows := DBMS_XMLSTORE.insertxml(savCtx,myclob);
    DBMS_XMLSTORE.closeContext(savCtx);
    DBMS_OUTPUT.PUT_LINE(v_rows || ' rows inserted...');
    end;
    I have no problem inserting the document using:
    INSERT INTO XMT_OPERAZIONE_LOG VALUES
    ( XMLType(
    '<operazione.log xmlns="http://www.hp.com/best/next/trx"
                        xmlns:xdb="http://xmlns.oracle.com/xdb"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xsi:schemaLocation="http://www.hp.com/best/next/trx operazione.log.xsd">
         <Operazione>Text</Operazione>
         <Journal>
              <NumeroElettronico>9900000000</NumeroElettronico>
              <CodiceFiliale>FIL01</CodiceFiliale>
              <CausaleOperazione>21</CausaleOperazione>
              <Inizio>2001-12-17T09:30:47</Inizio>
              <Termine>2001-12-17T09:30:47</Termine>
              <DescOperazione>Bonifico</DescOperazione>
              <Importo>1000.10</Importo>
              <Operatore>Relli</Operatore>
              <Status>OPERAZIONE_PRESA_IN_CARICO</Status>
              <DescErrore>String</DescErrore>
         </Journal>
    </operazione.log>'));
    what is wrong ?
    I tried with the following XML but I got the same error.
    <ROWSET>
    <ROW num="1">
    <operazione.log xmlns="http://www.hp.com/best/next/trx"
                        xmlns:xdb="http://xmlns.oracle.com/xdb"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xsi:schemaLocation="http://www.hp.com/best/next/trx operazione.log.xsd">
         <Operazione>Text</Operazione>
         <Journal>
              <NumeroElettronico>9900000000</NumeroElettronico>
              <CodiceFiliale>FIL01</CodiceFiliale>
              <CausaleOperazione>21</CausaleOperazione>
              <Inizio>2001-12-17T09:30:47</Inizio>
              <Termine>2001-12-17T09:30:47</Termine>
              <DescOperazione>Bonifico</DescOperazione>
              <Importo>1000.10</Importo>
              <Operatore>Relli</Operatore>
              <Status>OPERAZIONE_PRESA_IN_CARICO</Status>
              <DescErrore>String</DescErrore>
         </Journal>
    </operazione.log>
    </ROW>
    </ROWSET>

    hello!
    i had the same problem. check if you are going to insert data into every field in the table which isnt nullable! i hope it helps

  • DBMS_XMLStore package

    In emp table i'm having releving_date column as not null and no default value. Without getting releving date from XML message how to populate value into emp table using dbms_XMLStore package. In the below example whater values we are getting from XML message that also populating. If we want to pouplate extra coulumsn means what to do?
    DECLARE
    insCtx DBMS_XMLStore.ctxType;
    rows NUMBER;
    xmldoc CLOB :=
    '<ROWSET>
    <ROW num="1">
    <EMPNO>7369</EMPNO>
    <SAL>1800</SAL>
    <HIREDATE>27-AUG-1996</HIREDATE>
    </ROW>
    <ROW>
    <EMPNO>2290</EMPNO>
    <SAL>2000</SAL>
    <HIREDATE>31-DEC-1992</HIREDATE>
    </ROW>
    </ROWSET>';
    BEGIN
    insCtx := DBMS_XMLStore.newContext('scott.emp'); -- get saved context
    DBMS_XMLStore.clearUpdateColumnList(insCtx); -- clear the update settings
    -- set the columns to be updated as a list of values
    DBMS_XMLStore.setUpdateColumn(insCtx,'EMPNO');
    DBMS_XMLStore.setUpdateColumn(insCtx,'SAL');
    DBMS_XMLStore.setUpdatecolumn(insCtx,'HIREDATE');
    -- Now insert the doc.
    -- This will only insert into EMPNO, SAL and HIREDATE columns
    rows := DBMS_XMLStore.insertXML(insCtx, xmlDoc);
    -- Close the context
    DBMS_XMLStore.closeContext(insCtx);
    END;
    thanks for your help!
    Kannan

    user601042 wrote:
    In emp table i'm having releving_date column as not null and no default value. Without getting releving date from XML message how to populate value into emp table using dbms_XMLStore package. In the below example whater values we are getting from XML message that also populating. If we want to pouplate extra coulumsn means what to do?If you want to use DBMS_XMLSTORE, you need to have the column as tag in xml. There is no other way.
    At first, you can use XSL to add the "missing" tag, with the desired data, to the xml. Then you can use the transformed xml with DBMS_XMLSTORE to load the data in the table

  • Dbms_XMLStore package use

    Hi,
    I am on 10.2 (on Linux).
    I am planning to use dbms_XMLStore package to load XML data in Oracle database.
    When I tested it for 10.1, there were few issues (like not picking up blank tags i.e. <name/> properly). Looks like these issues are not there in 10.2.
    Is anybody out there using this package? Any issues/problems?
    Also, this package uses the SAX parser. Does that mean, the complete XML need not be in memory? The processor can start processing and need not first read/cache the whole XML ?
    Thanks

    Hi,
    I am on 10.2 (on Linux).
    I am planning to use dbms_XMLStore package to load XML data in Oracle database.
    When I tested it for 10.1, there were few issues (like not picking up blank tags i.e. <name/> properly). Looks like these issues are not there in 10.2.
    Is anybody out there using this package? Any issues/problems?
    Also, this package uses the SAX parser. Does that mean, the complete XML need not be in memory? The processor can start processing and need not first read/cache the whole XML ?
    Thanks

  • DBMS_XMLSTORE.UpdateXML error when node is empty

    We are using Oracle version 11.2.0.1.0.
    We are using DBMS_XMLStore.UpdateXML to directly update from XML and are having an issue when an empty node is passed within the XML.
    If I pass this xml to updateXML to clear out field C1 I get an error.
    <ROWSET table="My_Table">
    <record>
    <M_ID>47</M_ID>
    <C1></C1>
    <C2>999998</C2>
    <C3>2010-07-12T10:00:00</C3>
    <C4>Reason1</C4>
    </record>
    </ROWSET>
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00222: error received from SAX callback function
    ORA-00927: missing equal sign
    I've seen this issue listed back in 2007 and there claims to have been a fix for version 10.2.0.1.
    Is there a fix or a workaround for this?

    Hi,
    This works for me on 11.2.0.2 :
    SQL> create table my_table (
      2   m_id number,
      3   c1 varchar2(30),
      4   c2 number,
      5   c3 date,
      6   c4 varchar2(30)
      7  );
    Table created
    SQL>
    SQL> insert into my_table
      2  values(47, 'TEST', 999999, null, null);
    1 row inserted
    SQL>
    SQL> DECLARE
      2 
      3   ctx dbms_xmlstore.ctxHandle;
      4   doc xmltype := xmltype('<ROWSET table="My_Table">
      5  <record>
      6  <M_ID>47</M_ID>
      7  <C1></C1>
      8  <C2>999998</C2>
      9  <C3>2010-07-12T10:00:00</C3>
    10  <C4>Reason1</C4>
    11  </record>
    12  </ROWSET>');
    13 
    14   res number;
    15 
    16  BEGIN
    17 
    18   ctx := dbms_xmlstore.newContext('MY_TABLE');
    19   dbms_xmlstore.setRowTag(ctx, 'record');
    20   dbms_xmlstore.setKeyColumn(ctx, 'M_ID');
    21   dbms_xmlstore.setUpdateColumn(ctx, 'C1');
    22   dbms_xmlstore.setUpdateColumn(ctx, 'C2');
    23   res := dbms_xmlstore.updateXML(ctx, doc);
    24 
    25  END;
    26  /
    PL/SQL procedure successfully completed
    SQL> select * from my_table;
          M_ID C1                 C2 C3          C4
            47                999998

  • How to filter particular xml tag value using -DBMS_XMLGEN / DBMS_XMLSTORE

    Hi,
    I am using dbms_xmlgen and dbms_xmlstore package to extract xml datafile tag value from file server to oracle database table.
    I have used the below pl/sql program to extract the xml tag values to oracle relational table.Its working fine for me.
    But I would like to extract the values based on particular filter condition.
    The following xml program I have 3 rows I would like extract the xml data based on the following condition .
    Filter condition
    ==============
    the tag <STATE_ABBREVIATION> value shuold be 'CA' and the <CITY> tag value should be Palo_Alto then I will store the ZIPCODE
    ZIP_CODE_EXTN,STATE_ABBREVIATION tag values in the Oracle Relational table.
    The below pl/sql program storing all the three rows but I required the values based on the filter condition that I mentioned earlier.
    Kindly assist me what are the steps that I need to change in this program.?
    XML Program file content.
    ======================
    <ZIPCODES>
    <mappings>
    <STATE_ABBREVIATION>CA</STATE_ABBREVIATION>
    <ZIPCODE>94301</ZIPCODE>
    <ZIP_CODE_EXTN>9277</ZIP_CODE_EXTN>
    <CITY>Palo_Alto</CITY>
    </mappings>
    <mappings>
    <STATE_ABBREVIATION>CA</STATE_ABBREVIATION>
    <ZIPCODE>95302</ZIPCODE>
    <ZIP_CODE_EXTN>9279</ZIP_CODE_EXTN>
    <CITY>LA</CITY>
    </mappings>
    <mappings>
    <STATE_ABBREVIATION>TX</STATE_ABBREVIATION>
    <ZIPCODE>75038</ZIPCODE>
    <ZIP_CODE_EXTN>7837</ZIP_CODE_EXTN>
    <CITY>DALLAS</CITY>
    </mappings>
    </ZIPCODES>
    PL/SQL Program for XML extract.
    ==========
    declare
    charString varchar2(80);
    finalStr varchar2(4000) := null;
    rowsp number;
    insCtx DBMS_XMLStore.ctxType;
    ctx dbms_xmlgen.ctxHandle;
    v_FileHandle UTL_FILE.FILE_TYPE;
    begin
    v_FileHandle := utl_file.fopen('XMLTEST','XML_NEW_CITIES.XML','r') ;
    loop
    BEGIN
    utl_file.get_line(v_FileHandle, charString);
    exception
    when no_data_found then
    utl_file.fclose(v_FileHandle);
    exit;
    END;
    dbms_output.put_line(charString);
    if finalStr is not null then
    finalStr := finalStr || charString;
    else
    finalStr := charString;
    end if;
    end loop;
    insCtx := DBMS_XMLStore.newContext('SYS.ZIPCODES');
    dbms_xmlgen.setRowsetTag(insCtx,'ZIPCODES');
    dbms_xmlgen.setRowsetTag(insCtx,'mappings');
    DBMS_XMLStore.clearUpdateColumnList(insCtx);
    DBMS_XMLStore.setUpdateColumn(insCtx,'ZIPCODE');
    DBMS_XMLStore.setUpdateColumn(insCtx,'ZIP_CODE_EXT N');
    DBMS_XMLStore.setUpdateColumn(insCtx,'STATE_ABBREV IATION');
    rowsp := dbms_xmlstore.insertXML(insCtx,finalstr);
    end;
    Thanks,
    nat

    Thanks for your reply. :)
    Its working fine in the DBMS_XMLSTORE package. Here I have given the code
    CREATE OR REPLACE TYPE typ_dummy AS  OBJECT
    ( "@ENO"   NUMBER,
      "@ENAME" VARCHAR2(100),
      eno      NUMBER,
      ename    VARCHAR2(100));
    CREATE TABLE EMP
      empno    VARCHAR2(25),
      sal      NUMBER,
      hiredate DATE,
      typ      TYP_DUMMY
    DECLARE
      insCtx DBMS_XMLStore.ctxType;
      rows NUMBER;
      xmldoc CLOB :=
        '<ROWSET>
           <ROW num="1">
             <SAL>1800</SAL>
             <EMPNO>739</EMPNO>
             <HIREDATE>27-AUG-1996</HIREDATE>
               <TYP ENO="739" ENAME="Nazurullah">
               <ENO> 1 </ENO>
               <ENAME> ALDRIN </ENAME>
               </TYP>
           </ROW>
           <ROW>
             <SAL>18000</SAL>
             <EMPNO>7369</EMPNO>
             <HIREDATE>27-AUG-1996</HIREDATE>
             <TYP ENO="7369" ENAME="PEPPIN" />
           </ROW>
           <ROW>
             <SAL>37000</SAL>
             <EMPNO>20701</EMPNO>
             <HIREDATE>27-AUG-1996</HIREDATE>
             <TYP>
               <ENO> 20701 </ENO>
               <ENAME> VENKATACHALAM </ENAME>
             </TYP>
           </ROW>
         </ROWSET>';
    BEGIN
      insCtx := DBMS_XMLStore.newContext('emp'); -- get saved context
      -- Now insert the doc.
      -- This will only insert into EMPNO, SAL and HIREDATE columns
      rows := DBMS_XMLStore.insertXML(insCtx, xmlDoc);
      -- Close the context
      DBMS_XMLStore.closeContext(insCtx);
    END;
    SELECT * FROM emp;
    EMPNO        SAL HIREDATE          TYP(@ENO, @ENAME, ENO, ENAME)
    739         1800 27-AUG-96     TYP_DUMMY(739, 'Nazurullah', 1, ' ALDRIN ')
    7369       18000 27-AUG-96     TYP_DUMMY(7369, 'PEPPIN', NULL, NULL)
    20701      37000 27-AUG-96     TYP_DUMMY(NULL, NULL, 20701, ' VENKATACHALAM ')

  • Inserting Date AND Time using DBMS_XMLStore.insertXML

    Hello,
    I'm using a c# app to create an xml file to be passed to a stored procedure. The store procedure then uses DBMS_XMLStore.insertXML to insert the record in the xml file into the database.
    There is a field in the Oracle table called "ENTER_DATE". I've been putting a date into the xml file for this field (ie. "10-mar-2010") and this has worked fine. However, I've now been asked to include the time with the date.
    Is it possible to somehow put a date AND time value in the xml tag value so that DBMS_XMLStore.insertXML will properly insert it into the Oracle table? Everything I try returns a date picture format error.
    Thanks

    SQL> create table dept2
    as
       select d.*, sysdate enter_date
         from dept d
        where 1 = 2
    Table created.
    SQL> select * from dept2
    no rows selected.
    SQL> alter session set nls_date_format='dd.mm.yyyy hh24:mi:ss'
    Session altered.
    SQL> declare
       ctx   dbms_xmlstore.ctxtype := dbms_xmlstore.newcontext ('dept2');
       doc  xmltype
          := xmltype('<START>
                   <ROW>
                     <DEPTNO>10</DEPTNO>
                     <DNAME>ACCOUNTING</DNAME>
                     <LOC>NEW YORK</LOC>
                     <ENTER_DATE>10.10.2010 23:11:16</ENTER_DATE>
                   </ROW>
                         </START>');
       ret   int;
    begin
       ret := dbms_xmlstore.insertxml (ctx, doc);
       dbms_xmlstore.closecontext (ctx);
    end;
    PL/SQL procedure successfully completed.
    SQL> select * from dept2
        DEPTNO DNAME          LOC           ENTER_DATE          
            10 ACCOUNTING     NEW YORK      10.10.2010 23:11:16 
    1 row selected.

  • How to store multiple child nodes using dbms_xmlstore

    Hi,
    I'm using oracle 10g environment. In DBMS_XMLSTORE package I cannot able to insert the multiple child node value into db table.
    Here I have given the xml value
    <DATAPACKET REQUEST-ID="10001094">
      <HEADER>
        <SEARCH-RESULT-LIST>
          <SEARCH-RESULT-ITEM NAME="Ra-Al-Gul" CONFIDENCE-SCORE="750" BUREAU-ID="893991307899440">
            <IDENTIFIERS>
              <IDENTIFIER IDSOURCE="0001" MATCHED="TRUE"/>
            </IDENTIFIERS>
            <SURROGATES>
              <SURROGATE ID="CH0001" MATCHED="TRUE"/>
              <SURROGATE ID="CH0002" MATCHED="TRUE"/>
              <SURROGATE ID="CH0003" MATCHED="TRUE"/>
            </SURROGATES>
          </SEARCH-RESULT-ITEM>
        </SEARCH-RESULT-LIST>
      </HEADER>
    </DATAPACKET>for this xml data I have created the below table structure
    -- Table create script
    CREATE TABLE xml_insert (datapacket t_response );
    /* Type creation  code  */
    CREATE OR REPLACE TYPE t_response AS OBJECT
      "@REQUEST-ID" VARCHAR2(100),
      header        t_resp_header
    CREATE OR REPLACE TYPE t_resp_header AS OBJECT
      "SEARCH-RESULT-LIST"    t_search_item
    CREATE OR REPLACE TYPE t_search_item AS OBJECT
    ("SEARCH-RESULT-ITEM"      t_search_list);
    CREATE OR REPLACE TYPE t_search_list AS OBJECT
    ("@NAME"           VARCHAR2(300),
    "@CONFIDENCE-SCORE"      VARCHAR2(300),
    "@BUREAU-ID"           VARCHAR2(300),
    IDENTIFIERS           t_search_identifiers,
    SURROGATES           t_search_surrogates
    CREATE OR REPLACE TYPE t_search_identifiers AS OBJECT
    (IDENTIFIER           t_search_IDENTIFIER);
    CREATE OR REPLACE TYPE t_search_identifier AS OBJECT
      "@IDSOURCE"           VARCHAR2(20),
      "@MATCHED"           VARCHAR2(20)
    CREATE OR REPLACE TYPE t_search_surrogates AS OBJECT
    (SURROGATE           t_search_SURROGATE);
    CREATE OR REPLACE TYPE t_search_surrogate AS OBJECT
    "@ID"                VARCHAR2(20),
    "@MATCHED"           VARCHAR2(20)
    CREATE OR REPLACE TYPE tb_search_surrogate AS TABLE of t_search_SURROGATE;
    /and run this block
      DECLARE
      insCtx DBMS_XMLStore.ctxType;
      rows NUMBER;
      xmldoc CLOB :=
    <ROWSET>
    <ROW>
    <DATAPACKET REQUEST-ID="Q10001094">
      <HEADER>
        <SEARCH-RESULT-LIST>
          <SEARCH-RESULT-ITEM NAME="Anis kulam" CONFIDENCE-SCORE="750" BUREAU-ID="893991307899440">
            <IDENTIFIERS>
              <IDENTIFIER IDSOURCE="0001" MATCHED="TRUE"/>
            </IDENTIFIERS>
            <SURROGATES>
              <SURROGATE ID="CH0001" MATCHED="TRUE"/>
              <SURROGATE ID="CH0002" MATCHED="TRUE"/>
              <SURROGATE ID="CH0003" MATCHED="TRUE"/>
            </SURROGATES>
          </SEARCH-RESULT-ITEM>
        </SEARCH-RESULT-LIST>
      </HEADER>
    </DATAPACKET>
    </ROW>
    </ROWSET>';
    BEGIN
      insCtx := DBMS_XMLStore.newContext('xml_check');
      rows := DBMS_XMLStore.insertXML(insCtx, xmlDoc);
      DBMS_XMLStore.closeContext(insCtx);
    END;I got the following error
    Error Messgae :
    ORA-19031: XML element or attribute SURROGATE does not match any in type DOHADEV.T_CRB_SEARCH_SURROGATES
    ORA-06512: at "SYS.DBMS_XMLSTORE", line 78
    ORA-06512: at line 28

    Hi,
    A couple of comments to begin with :
    - Your setup script, test case and error message are not consistent with each other.
    - You've not chosen the easiest road with DBMS_XMLSTORE and nested objects. As pointed out in a previous thread of yours, the whole thing would be far more simple with XMLTable.
    Do you really need to store the data in an object-relational structure at the end, or do you intend to further break it down into relational rows and columns?
    Do you have an XML schema?

  • External Parser - XML to Pipe Delimited - Sql Loader BETTER DBMS_XMLSTORE

    Hi All,
    If I have got data in GIGs in a complex format.
    Can Using an External Java based XML Parser to convert XML to Pipe Delimited FIle and then Using SQL Loader
    BE BETTER THAN
    Using XSL to convert to Oracle <ROWSET> <ROW> Format and using DBMS_XMLSTORE to load data into tables.
    In terms of:
    Performace
    Scalability
    Exception Handling
    Regards....

    Go to the {forum:id=34} forum and look at the second page of the XML DB FAQ Thread (stickied to the top of the posts). While it doesn't compare using external tools to parse XML and load via SQL*Loader, it does talk about better ways to load large amounts of XML into the DB. This is also a good thread on the subject too from that forum, {thread:id=1096784}

  • Performance Problem..DBMS_XMLStore or SQL Loader

    Hi All,
    I have implemented the insertion of data using the following method but it's taking very long.
    Once XML and XSL files are there in mapped 'Directory_Path'....
    BEGIN
    SELECT directory_name INTO v_directory_name
    FROM all_directories
    WHERE owner = 'SYS'
    AND directory_name = 'Directory_Path';
    END;
    xmldata1 := XMLTYPE(BFILENAME(v_directory_name, 'temp_xml.xml'), nls_charset_id('UTF8'));
    xmldata2 := XMLTYPE(BFILENAME(v_directory_name, 'temp_xml.xsl'), nls_charset_id('UTF8'));
    --Open a new context, required for these procedures
    v_context := DBMS_XMLSTORE.newContext('TEMP_XML');
    v_rows := DBMS_XMLStore.insertXML(
    v_context,
    XMLType.transform(xmldata1, xmldata2));
    -- Close the context
    DBMS_XMLStore.closeContext(v_context);
    END;
    May be I am converting data from BFILE to XMLType. But XMLType.transform(xmldata1, xmldata2) accepts XMLType data only.
    Or May be this approach where I am not giving the column names explicitly..
    Earlier I was loading the transformed XML file(With ROWSET ROW Format) in the the 'Directory_Path' and loading the data as
    DECLARE
    insCtx DBMS_XMLSTORE.ctxType;
    rows NUMBER;
    v_directory_name VARCHAR2(300);
    src_file BFILE ;
    BEGIN
    BEGIN
    SELECT directory_name INTO v_directory_name
    FROM all_directories
    WHERE owner = 'SYS'
    AND directory_name = 'Directory_Path';
    END;
    src_file := BFILENAME(v_directory_name, XMLFILE.xml');
    insCtx := DBMS_XMLSTORE.newContext( 'TABLE_NAME'); -- Get saved context
    DBMS_XMLSTORE.clearUpdateColumnList(insCtx); -- Clear the update settings
    -- Set the columns to be updated as a list of values
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'COLUMN1');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'COLUMN2');
    -- Insert the doc.
    rows := DBMS_XMLSTORE.insertXML(insCtx, xmltype(src_file,nls_charset_id('AL32UTF8')));
    DBMS_OUTPUT.put_line(rows || ' rows inserted.');
    -- Close the context
    DBMS_XMLSTORE.closeContext(insCtx);
    END;
    This was happening in a fraction of a second.
    But for thousands of XMLs we can't manually generate the Transformed XMLs even if there is a single type of XSL for all those.
    AM I MISSING SOMETHING VERY ELEMENTARY OVER HERE???
    (I didn't meant to shout by putting in CAPS but highlight it so that it's not missed..Apologies )
    The new suggestion being given is PARSE XML FILE into PIPE DELIMITED FORMAT FILE and LOAD that data through SQL LOADER
    Personally I don't think it would be better when Oracle is giving us an inbuilt feature.
    PLEASE HELP....
    How can I improve this. I really think I am taking some wrong step somewhere.....
    Regards.....

    Thanks A_NON,
    But I actually did load within 4 seconds using the below approach without registering as mentioned here.
    xmldata1 :=
    XMLTYPE (BFILENAME (v_directory_name,
    p_xml_file_nme
    NLS_CHARSET_ID ('UTF8')
    xmldata2 :=
    XMLTYPE (BFILENAME (v_directory_name,
    p_xsl_file_nme
    NLS_CHARSET_ID ('UTF8')
    SELECT XMLTRANSFORM (xmldata1, xmldata2) AS temp2
    INTO temp2
    FROM DUAL;
    And then
    insCtx := DBMS_XMLSTORE.newContext( 'TABLE_NAME'); -- Get saved context
    DBMS_XMLSTORE.clearUpdateColumnList(insCtx); -- Clear the update settings
    -- Set the columns to be updated as a list of values
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'COLUMN1');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'COLUMN2');
    I will try to optimise it more now. But 4 seconds is beautiful you see. :-)
    Thanks for All the help A_NON and I think I have learnt some Oracle XML DB over here.
    Hope to answer some basic questions too in future.. :-)
    Regards....

  • DBMS_XMLSTORE causes 'Space' to be inserted before value.

    Hi,
    I have data without any space in the XML file i.e.
    <TAG1> I </TAG2>
    But when I try to insert the data in the table using :
    DBMS_XMLSTORE.setUpdateColumn(insCtx,'TAG1');
    I get the asnwer as ' I' i.e. there is a space before 'I'.
    I can't insert the data like this because Partition doesn't accept it.
    Please help.
    Regards,
    Sudhir

    I can't reproduce the problem on that version.
    Could you give a sample xml document for which you have the issue?
    Please post the exact content within tags.
    Also post the PL/SQL code you're using to load the xml (within &#x7B;code} tags as well).
    Thanks.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Dbms_xmlstore.newcontext and synonyms

    We have a function that is using dbms_xmlstore.newcontext. The function works fine when we pass it a table name, but not a synonym.
    i.e.
    we create a table user1.table1
    we create a public synonym table1 for table1
    we run dbms_xmlstore.newcontext('table1') as user2 and it fails.
    we run dbms_xmlstore.newcontext('user1.table1') as user2 and it works
    user2 is able to access table1 using the synonym e.g. select * from table1.
    Is this intended behavior or is something wrong?

    user2 has all rights to the user1 table. In fact, I tried creating the table as user2 and then creating a synonym to the newly created table and that didn't work either.
    e.g.
    create table user2.table2
    create public synonym table1 for table2
    dbms_xmlstore.newcontext('table2') works
    dbms_xmlstore.newcontext('table1') does not
    it appears that dbms_xmlstore.newcontext is accessing the table definition directly and bypassing the synonym.

  • Dbms_xmlstore Error stack

    10.2.0.3 fixed a problem with DBMS_XMLSTORE. The error stack in 10.2.0.1 does not show the SQLERRM just a generic ORA-31011. Since XE does not upgrade to 10.2.0.3 has anyone found a way around this for XE 10g.

    Hi!
    I would be careful on this one. In the manual it states
    "This chapter provides an overview of upgrading Oracle Database Express Edition to Oracle Database 10g release 2 (10.2.0.3)." which would mean you can upgrade it to Standard or Enterprise but not to XE 10.2.0.3
    This is the reason why in you have to change your Database and SID in Step three of the process
    "Rename the database by entering a new Global Database Name and Oracle system identifier (SID)."
    as you can find here
    http://download.oracle.com/docs/cd/B25329_01/doc/server.102/b32391/overview.htm#CJAJDBID
    Best regards,
    PP

  • DBMS_XMLStore.setkeycolumn

    I am tracking ORA_ROWSCN at row level using ROWDEPENDENCIES.
    If ORA_ROWSCN is used a normal update query it is not causing any problems.
    Error occurs while used it inside a XML for updation as
    DBMS_XMLStore.setkeycolumn(v_context,'ORA_ROWSCN').*
    This shows an error thar ORA_ROWSCN sepcified to be a key column does not exists in table.*
    Any idea how to use ORA_ROWSCN while updating using XML?
    Thank You,
    Joseph

    ORA_ROWSCN is a pseudocolumn. It is not a column any more than rownum or rowid is a column. You can not use it to identify a row.
    You shouldn't even try.
    Read Tom Kyte's comments on my website:
    http://www.morganslibrary.org/reference/pseudocols.html#psos
    and you will understand even more why this is not something you would want to do even if you could.

Maybe you are looking for

  • XML Generated using given DTD

    hi guys , i have to make a java GUI application to generate an xml file. to accomplish this the code must: 1...... ask the user to input the path of the DTD file according to which the xml file will be generated. 2........then it should parse the DTD

  • [Newbie] Script output

    Can anyone help me out to get the output on two rows in excel. for /f "skip=3" %i in ('qfarm /load') do quser /server:%i | find /i /c "Active" && echo %i >> "c:\Temp\server.csv" I can get them on row A and B. Is there also away to get the total amoun

  • I cannot open youtube videos to full screen after downloading the latest version of flash. HELP

    I cannot open youtube videos to full screen after updateding flash to the latest version (11. something) HELP! youtube says it is adobe's problem

  • WLS 10.0: Security: LDAP Authenticator

    hi,           I'm using WLS 10.0 with the following security providers:           - SQL Authenticator (for weblogic console users like system)           - Identity Asserter (custom developed, takes care for AUTHENTICATION only)           - LDAP Authe

  • How do I remove repeats of public holidays from iCloud calendar

    In my iCloud calendar I have several instances of each UK public holiday.  I would prefer only one, but how do I remove the extra ones?