DBMS_XMLSave.insertXML

Hi All,
I am using DBMS_XMLSave.insertXML to read a XMl file and store it in a table.
But the maximum record I am able to insert into the oracle table is limited around 80...
I have tried using DBMS_XMLSave.setBatchSize but it is not helping me.
let me know if there is any way to increase the buffer?

Lucky boy, you have DBMS_XMLSave in sys schema, I have not....
Did you try to use dbms_xmlsave.setBatchSize ? Set about 10% of total xml size (in bytes). This should improve performace greatelly.

Similar Messages

  • Error while using dbms_xmlsave.UpdateXML and dbms_xmlsave.insertXML

    The Record I am trying to insert/update has the following structure
    <ROWSET>
    <ROW>
    <COL1>123</COL1>
    </ROW>
    </ROWSET>
    Table structure is as below
    COL1 INT [Primary constraint]
    COL2 VARCHAR2(100) NOT NULL [but has default value of 'COL2_Default']
    Now since the XML doesn't have the entry for COL2, I am explicitly setting the columns to be updated/inserted using dbms_xmlsave.setUpdateColumn.
    I use the logic the following logic to insert/update the table
    -- set the primary key column name. This forms the where clause for update statement
    dbms_xmlsave.setkeycolumn(l_Context , 'COL1');
    -- cXML have the XML structure mentioned above
    l_rows := dbms_xmlsave.updateXML(l_Context, cXML);
    IF l_rows <= 0 THEN -- which means no rows found for update
    l_rows := dbms_xmlsave.insertXML(l_Context, cXML);
    END IF;
    Now when the excution of dbms_xmlsave.updateXML happens Java Runtime Error is thrown.
    ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException: 'java.sql.SQLException: Missing IN or OUT parameter at index:: 5' encountered during processing ROW element 0. All prior XML row changes were rolled back. in the XML document.
    The version of oracle I am using is 9.2.0.6.0.
    Please let me know if anyone has any idea on this error.

    Found maybe an applicable reference...
    On http://publib.boulder.ibm.com/infocenter/wasinfo/v4r0/index.jsp?topic=/com.ibm.support.was.doc/html/Java_2_Connectivity_(J2C)/1163246.html
    it says:
    * Application code is missing a setXXX method call somewhere.
    * There might be a problem in the Oracle JDBC driver code.
    If the latter is the problem than you should or try a different JDBC driver or (which is probably the best solution anyway) create an iTar with Oracle support via metalink.oracle.com
    Other references can also be found on the internet when using google which could be applicable. Search on keywords: "Missing IN or OUT parameter at index"
    Message was edited by:
    mgralike

  • Using dbms_xmlsave.insertXML

    Hi all,
    I am reading an XML data which has similar structure to:
    <dept>
    <name> department name </name>
    <loc> department location </loc>
    <emp>
    <fisrt> first name for first employee </first>
    <last> last name for first employee </last>
    </emp>
    <emp>
    <first> first name for second employee </first>
    <last> last name for second employee </last>
    </emp>
    </dept>
    I do not have control on the structure of the XML data as I am reading it from external source. Now I have created a table as follows:
    SQL> create type emprec as object (
    first varchar2(30),
    last varchar2(30)
    SQL> create type empreclist as table of emprec;
    SQL> create table mydept (
    name varchar2(30),
    loc varchar2(50),
    emp empreclist);
    Now when I use the dbms_xmlsave.insertXML , the columns name,loc are populated but the column emp is not populated and i I define the emp column as (emprec) type, then only the last <emp></emp> data is inserted.
    Any ideas how to read all the <emp></emp> data into the dept table ?

    Hi,
    I have been trying for a while to get a nested collection loaded. The oracle documentation is no help. But what i did in the end is this. I built the object table, inserted the nested collection manual and then ran the command line XSU (documented in the app. dev. guide xml) to save the tabledata as XML (only one record) with the -withDTD switch. This creates a XML with inline DTD. Surprise surprise when you load that document it does work, even when you add more nested rows in the document. This XML file will also show you if you build the table correctly. It seems that XSU needs the DTD to be able to load nested collections.
    If you are running windows the command line utility can be run like this
    java -cp c:\oracle\ora81\rdbms\jlib\xsu12.jar;c:\oracle\ora81\lib\xmlparserv2.jar;c:\oracle\ora81\jdbc\lib\classes12.zip OracleXML getXML -user "username/password" -withDTD "select * from yourtable" >g:\xmlfiles\output.xml
    have fun

  • DBMS_XMLSave.insertXML slow.

    Hi,
    I am using the function DBMS_XMLSave.insertXML to take a clob (XML file) off a queue, and process
    the file into a table. I am finding that inserting 10,000 records (from a single clob) is taking over 30secs.
    This is an order of magnitude out from where I expected to be. It would be nice (clean) to
    be able to order my App this way using XML documents and Advanced Queues, but if I cant get the times
    down further I will need to look at other alternatives.
    Is there a way to improve the performance of DBMS_XMLSave.insertXML?
    Thanks,
    Matt

    Lucky boy, you have DBMS_XMLSave in sys schema, I have not....
    Did you try to use dbms_xmlsave.setBatchSize ? Set about 10% of total xml size (in bytes). This should improve performace greatelly.

  • DBMS_XMLSave.insertXML Fails on decimal format

    DBMS_XMLSave.insertXML Fails on decimal format
    The following example fails when using collections of complex elements. The error is:
    java.lang.NumberFormatException: 1.0'
    Example is:
    create table test_parent(p_id NUMBER(18),
    test_col number(10))
    alter table test_parent add constraint pk1 primary key(p_id)
    create table test_child(t_id NUMBER(18),
    test_col number(10),
    p_id NUMBER(18))
    alter table test_child add constraint pk2 primary key(t_id)
    alter table test_child add constraint fk1 foreign key (p_id) references test_parent(p_id)
    insert into test_parent values(1,1)
    insert into test_child values(1,1,1)
    insert into test_child values(2,2,1)
    insert into test_child values(3,3,1)
    create type test_c AS OBJECT (t_id NUMBER(18),test_col NUMBER(10));
    CREATE OR REPLACE TYPE test_cs AS TABLE OF test_c
    CREATE OR REPLACE VIEW test_view(parent_id,parent_num,child)
    AS SELECT p.P_id,
    p.test_col,
    CAST(MULTISET(SELECT c.t_id,
    c.test_col
    FROM test_child c
    WHERE p.p_id = c.p_id) AS test_cs) AS child
    FROM test_parent P
    CREATE OR REPLACE TRIGGER test_trig INSTEAD OF INSERT ON test_view
    BEGIN
    DBMS_OUTPUT.PUT_LINE('Trigger proccessing');
    END;
    SHOW ERRORS
    DECLARE
    insCtx DBMS_XMLSave.ctxType;
    rows number;
    xmlDoc CLOB := '<ROWSET>
    <ROW>
    <PARENT_ID>2.0</PARENT_ID>
    <PARENT_NUM>2.0</PARENT_NUM>
    <CHILD>
    <T_ID>1.0</T_ID>
    <TEST_COL>1.0</TEST_COL>
    </CHILD>
    </ROW>
    </ROWSET>';
    BEGIN
    insCtx := DBMS_XMLSave.newContext('TEST_VIEW');
    rows := DBMS_XMLSave.insertXML(insCtx,xmlDoc);
    DBMS_XMLSave.closeContext(insCtx);
    END;
    DECLARE
    insCtx DBMS_XMLSave.ctxType;
    rows number;
    xmlDoc CLOB := '<?xml version="1.0"?>
    <ROWSET>
    <ROW>
    <PARENT_ID>1</PARENT_ID>
    <PARENT_NUM>1</PARENT_NUM>
    <CHILD>
    <TEST_C>
    <T_ID>1.0</T_ID>
    <TEST_COL>1</TEST_COL>
    </TEST_C>
    <TEST_C>
    <T_ID>2</T_ID>
    <TEST_COL>2</TEST_COL>
    </TEST_C>
    <TEST_C>
    <T_ID>3</T_ID>
    <TEST_COL>3</TEST_COL>
    </TEST_C>
    </CHILD>
    </ROW>
    </ROWSET>';
    BEGIN
    insCtx := DBMS_XMLSave.newContext('TEST_VIEW');
    rows := DBMS_XMLSave.insertXML(insCtx,xmlDoc);
    DBMS_XMLSave.closeContext(insCtx);
    END;

    If you have access to ON, check out document 119140.1.
    Apparently it's a bug in the jdbc driver in pre-Oracle 8.1.7 databases...the workaround looks messy though.

  • DBMS_XMLSave.insertXML ORA-01024 error

    DBMS_XMLSave.insertXML ORA-01024 error
    The following error is being produced when trying to use DBMS_XMLSave.insertXML. The xml datagram was produced from the view using DBMS_XMLQuery.getXML. This works fine for non object nested views.
    Does anyone know of a problem with this approach or syntax.
    Thanks
    ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException: 'oracle.jdbc.driver.OracleSQLException:
    ORA-01024: invalid datatype in OCI call
    ' encountered during processing ROW element 1. All prior XML row changes were
    rolled back. in the XML document.
    ORA-06512: at "SYSTEM.DBMS_XMLSAVE", line 91
    ORA-06512: at "SJS.IMRES", line 60
    ORA-06512: at "SJS.IMRES", line 99
    ORA-06512: at line 6
    *************** Insert Procedure *******************
    PROCEDURE InsertXml(xmlDoc IN clob, tableName IN VARCHAR2) IS
    insCtx DBMS_XMLSave.ctxType;
    rows number;
    BEGIN
    DBMS_OUTPUT.PUT_LINE('INsertXml - '||tableName);
    insCtx := DBMS_XMLSave.newContext(tableName);
    rows := DBMS_XMLSave.insertXML(insCtx,xmlDoc);
    dbms_output.put_line('InsertXML -'||rows);
    DBMS_XMLSave.closeContext(insCtx);
    COMMIT;
    END InsertXml;
    *************** Object view *******************
    CREATE OR REPLACE TYPE sjs.imres_error_type AS OBJECT
    ("ResponseErrorCode"     VARCHAR2(10),
    "ResponseErrorDesc"     VARCHAR2(4000))
    CREATE OR REPLACE TYPE sjs.imres_errors_type AS TABLE OF imres_error_type
    CREATE OR REPLACE VIEW sjs.imresponse
    AS SELECT ith.a_id AS "ArrestNumber",
    CAST(MULTISET(SELECT ire.errorcode,
    ire.errordesc
    FROM sjs.imresponseerrors ire
    WHERE ire.ith_id = ith.ith_id) AS imres_errors_type) AS "Errors"
    FROM sjs.imtransactionhistory ith
    *************** XML DATAGRAM *******************
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW>
    <ArrestNumber>2</ArrestNumber>
    <Errors>
    <Errors_ITEM>
    <ResponseErrorCode>CODE 2</ResponseErrorCode>
    <ResponseErrorDesc>DESC 2</ResponseErrorDesc>
    </Errors_ITEM>
    <Errors_ITEM>
    <ResponseErrorCode>CODE 1</ResponseErrorCode>
    <ResponseErrorDesc>DESC 1</ResponseErrorDesc>
    </Errors_ITEM>
    </Errors>
    </ROW>
    </ROWSET>

    It seems to be related to an insert/update for the same context
    having different columns with "values" in it.
    I have 3 rows. For the AMT column the first row has 151.56,
    the second row has 100.00, the third row has .00
    The third row fails with this error :
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "MTRSTEST.KIM_RTL_XML_PKG", line 150
    ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException:
    Invalid context handle specified.
    ORA-06512: at "SYS.DBMS_XMLQUERY", line 170
    ORA-06512: at "MTRSTEST.KIM_RTL_XML_PKG", line 193
    ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException:
    Expected 'EOF'.
    ORA-06512: at "MTRSTEST.KIM_TEST", line 197
    ORA-06512: at line 1
    If I change the third row to say 10.00, for example, it works
    fine.
    We had not been on xdk9 yet, I'm having them install xdk9 and
    we'll see if the problem persists.

  • Loading data into XMLType column using dbms_xmlsave.insertxml get ORA-29532

    The following simple test case succeeded in 9.2.0.1 but failed in 9.2.0.2.
    CREATE OR REPLACE procedure InsertXML(xmlDoc IN VARCHAR2, tableName IN VARCHAR2) is
    insCtx DBMS_XMLSave.ctxType;
    rows number;
    begin
    insCtx := DBMS_XMLSave.newContext(tableName); -- get the context handle
    rows := DBMS_XMLSave.insertXML(insCtx,xmlDoc); -- this inserts the document
    dbms_output.put_line(to_char(rows) || ' rows inserted');
    DBMS_XMLSave.closeContext(insCtx); -- this closes the handle
    end;
    CREATE TABLE XMLtable
    (column1 xmltype)
    exec insertxml('<?xml version = "1.0"?><ROWSET><ROW><COLUMN1><TEST>HELLO</TEST></COLUMN1></ROW></ROWSET>', 'XMLTABLE');

    Hi,
    For your XML file I think you just need to enclose XML elemnts in ROWSET AND ROW TAGS - so xml should look like :
    <ROWSET>
    <ROW>
    <DEPT>
    </DEPT>
    and just pass it as CLOB to dbms_xmlsave.insertXML proc.
    I hope it should work.
    I am also trying to insert XML file but with a bit complex structure having multiple nested elements.
    I am not sure how to transform the external XML file to wrap it in ROWSET/ROW using XSLT. It's mandatory to use ROWSET/ROW tags to be able to insert in oracle tables. I am facing this problem right now. I am using object views to accomplish the purpose but still needs to figure out the way to apply stylesheet to incoming XML file.
    If you come to know of any way, pls do let me know also.
    Thanks

  • Default insertion for missing elements using DBMS_XMLSave.insertXML

    Hi,
    I am trying to insert default values for some columns, without having those column names as elements in the xml document. Is it possible to do so?? This is the code I am using for now, but it inserts null values for missing elements in the xml document.
    insCtx := DBMS_XMLSave.newContext ('TABLENAME'); -- get the context
    rows := DBMS_XMLSave.insertXML (insCtx, p_xmlDoc); -- insert the doc
    DBMS_XMLSave.closeContext (insCtx); -- close the handle

    Only thing I noticed with dbms_xmlstore.insertXML, was when my xml document had "<?xml version = "1.0" ?>" at the start, it gave an error "LPX-00209: PI names starting with XML are reserved"That's probably due to the XML document not starting exactly with "&lt;", like this :
    SQL> DECLARE
      2
      3    xmldoc   clob := '
      4  <?xml version="1.0"?>
      5        <ROWSET>
      6       <ROW>
      7        <COL1>1</COL1>
      8        <COL2>TEST1</COL2>
      9       </ROW>
    10       <ROW>
    11       <COL1>2</COL1>
    12      </ROW>
    13     </ROWSET>';
    14
    15    ctx      dbms_xmlstore.ctxHandle;
    16    numrows  number;
    17
    18  BEGIN
    19
    20    ctx := dbms_xmlstore.newContext('MY_TABLE');
    21    numrows := dbms_xmlstore.insertXML(ctx, xmldoc);
    22    dbms_xmlstore.closeContext(ctx);
    23
    24  END;
    25  /
    DECLARE
    ERROR at line 1:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00209: PI names starting with XML are reserved
    ORA-06512: at "SYS.DBMS_XMLSTORE", line 78
    ORA-06512: at line 21 However, it runs OK if the prolog actually starts the character stream :
    SQL> DECLARE
      2
      3    xmldoc   clob := '<?xml version="1.0"?>
      4        <ROWSET>
      5       <ROW>
      6        <COL1>1</COL1>
      7        <COL2>TEST1</COL2>
      8       </ROW>
      9       <ROW>
    10       <COL1>2</COL1>
    11      </ROW>
    12     </ROWSET>';
    13
    14    ctx      dbms_xmlstore.ctxHandle;
    15    numrows  number;
    16
    17  BEGIN
    18
    19    ctx := dbms_xmlstore.newContext('MY_TABLE');
    20    numrows := dbms_xmlstore.insertXML(ctx, xmldoc);
    21    dbms_xmlstore.closeContext(ctx);
    22
    23  END;
    24  /
    PL/SQL procedure successfully completed.
    With the dbms_xmlsave.inserXML, [...] it wont insert the default column values.Now that's strange...
    I understand there could be differences in the parsing implementation, but in the end both processes must issue an INSERT into the target table using plain SQL, so I really wonder why default values are not applied.
    I'll try to reproduce when I have access to a Java-enabled db.

  • Can't replicate data inserted using DBMS_XMLSAVE.insertXML

    Enviroment:
    OS: SLES 10 SP2
    Database Version: 11.1.0.6
    I have configured an Oracle Streams environment compose by two database. The first is the source where a local capture process should captures dml changes from some tables. If I insert some data using a classic dml insert operation the changes are replicated without problems. The problem is when the tables are populated using the DBMS_XMLSAVE.insertXML procedure. With that implementation there isn't data replication. I think DBMS_XMLSAVE.insertXML must generate redolog so the capture process should capture the changes from them but it doesn't seems to be like that.
    I need some suggestion about this matter, thank you.

    Here you are
    CREATE TABLE TEST.HABI
    ID_DATA NUMBER,
    ID_HOCU INTEGER,
    ID_HABI INTEGER,
    DESCRIPTION VARCHAR2(1000 BYTE)
    TABLESPACE USERS
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 32M
    NEXT 80K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    I'am not performe explicit commit here you are the procedure:
    FUNCTION import(p_id_data IN INTEGER,
    p_lote IN INTEGER,
    p_fecha_hotel DATE,
    p_error IN OUT NOCOPY CLOB,
    p_hab_habi IN OUT NOCOPY CLOB,
    p_hcl_clie IN OUT NOCOPY CLOB,
    p_hcl_habi IN OUT NOCOPY CLOB,
    p_hcl_hist IN OUT NOCOPY CLOB,
    p_tel_llpr IN OUT NOCOPY CLOB) Return integer
    AS
    ctx DBMS_XMLSAVE.ctxType;
    v_rows NUMBER;
    v_err_msg VARCHAR(4000);
    v_cant integer;
    BEGIN
    IF length(p_error) > (length('<?xml version = ''1.0''?><ENL_TRAN_ERROR/>') + 3) THEN
    ctx := DBMS_XMLSAVE.newContext('ENL_TRAN_ERROR');
    DBMS_XMLSAVE.setRowTag(ctx, 'ROW');
    --BEGIN
    v_rows := DBMS_XMLSAVE.insertXML(ctx, p_error);
    --EXCEPTION WHEN OTHERS THEN
    -- NULL;
    --END;
    DBMS_XMLSAVE.closeContext(ctx);
    END IF;
    IF length(p_hab_habi) > (length('<?xml version = ''1.0''?><ENL_TRAN_HAB_HABI/>') + 3) THEN
    ctx := DBMS_XMLSAVE.newContext('ENL_TRAN_HAB_HABI');
    DBMS_XMLSAVE.setRowTag(ctx, 'ROW');
    --BEGIN
    v_rows := DBMS_XMLSAVE.insertXML(ctx, p_hab_habi);
    --EXCEPTION WHEN OTHERS THEN
    -- NULL;
    --END;
    DBMS_XMLSAVE.closeContext(ctx);
    END IF;
    IF (INSTR(p_hcl_clie, '&')<>0) THEN
    p_hcl_clie := replace(p_hcl_clie, '&', '&amp;');
    END IF;
    IF length(p_hcl_clie) > (length('<?xml version = ''1.0''?><ENL_TRAN_HCL_CLIE/>') + 3) THEN
    ctx := DBMS_XMLSAVE.newContext('ENL_TRAN_HCL_CLIE');
    DBMS_XMLSAVE.setRowTag(ctx, 'ROW');
    --BEGIN
    v_rows := DBMS_XMLSAVE.insertXML(ctx, p_hcl_clie);
    --EXCEPTION WHEN OTHERS THEN
    -- NULL;
    --END;
    DBMS_XMLSAVE.closeContext(ctx);
    END IF;
    IF length(p_hcl_habi) > (length('<?xml version = ''1.0''?><ENL_TRAN_HCL_HABI/>') + 3) THEN
    ctx := DBMS_XMLSAVE.newContext('ENL_TRAN_HCL_HABI');
    DBMS_XMLSAVE.setRowTag(ctx, 'ROW');
    --BEGIN
    v_rows := DBMS_XMLSAVE.insertXML(ctx, p_hcl_habi);
    --EXCEPTION WHEN OTHERS THEN
    -- NULL;
    --END;
    DBMS_XMLSAVE.closeContext(ctx);
    END IF;
    IF length(p_hcl_hist) > (length('<?xml version = ''1.0''?><ENL_TRAN_HCL_HABI_HIST/>') + 3) THEN
    ctx := DBMS_XMLSAVE.newContext('ENL_TRAN_HCL_HABI_HIST');
    DBMS_XMLSAVE.setRowTag(ctx, 'ROW');
    --BEGIN
    v_rows := DBMS_XMLSAVE.insertXML(ctx, p_hcl_hist);
    --EXCEPTION WHEN OTHERS THEN
    -- NULL;
    --END;
    DBMS_XMLSAVE.closeContext(ctx);
    END IF;
    IF length(p_tel_llpr) > (length('<?xml version = ''1.0''?><ENL_TRAN_TEL_LLPR/>') + 3) THEN
    ctx := DBMS_XMLSAVE.newContext('ENL_TRAN_TEL_LLPR');
    DBMS_XMLSAVE.setRowTag(ctx, 'ROW');
    --BEGIN
    v_rows := DBMS_XMLSAVE.insertXML(ctx, p_tel_llpr);
    --EXCEPTION WHEN OTHERS THEN
    -- NULL;
    --END;
    DBMS_XMLSAVE.closeContext(ctx);
    END IF;
    END import;
    I hope you can help me.

  • Working with DBMS_XMLSave.insertXML and date fields

    Hello,
    I'm experiencing problems when loading date fields into the database.
    The date '20020717' in XML uploaded in the database using date format 'YYYYMMDD'
    becomes '20260920'. Is there something that I'm missing here or is this a bug in XSU?
    Versions I'm using
    Oracle XML Parser for PLSQL 9.2.0.2.0 Production
    Oracle 8.1.7.3 Database
    Hopefully the code below makes the question clear.
    PL/SQL part in which I insert the content of XMLClob into the table drtest.
    insCtx := Dbms_Xmlsave.newContext('drtest');
    Dbms_Xmlsave.SETDATEFORMAT(insCtx, 'YYYYMMDD');
    ROWS := Dbms_Xmlsave.insertXML(insCtx,XMLClob);
    Dbms_Xmlsave.closeContext(insCtx);
    Content of XMLCLob in the code
    <ROWSET>
    <ROW num="1">
    <DESALID>0000001829</DESALID>
    <DESAPNR>000000000000203997</DESAPNR>
    <DEINCO1>CIF</DEINCO1>
    <DEDELFL/>
    <DESALDT>20020717</DESALDT>
    <DECTRMA>BE</DECTRMA>
    <DESHIPT>BE</DESHIPT>
    <DECTRDP>BE</DECTRDP>
    </ROW>
    </ROWSET>

    When using date format strings in XSU, the format is defined not with the template for the Oracle DATE character strings, but with the Java SimpleDateFormat templates. Could this be the problem?

  • Error opening external DTD 'Segnatura.dtd' using dbms_xmlsave.insertXML

    I've been trying to insert a document in a table. All works fine
    if the xml doesn't contains the doctype element!
    If I add the row
    <!DOCTYPE Segnatura SYSTEM "Segnatura.dtd">
    to my xml I get the error:
    oracle.xml.sql.OracleXMLSQLException: Error opening external DTD
    'Segnatura.dtd'.
    If I specify all the path "file:///temp/Segnatura.dtd" the insert
    works, but I don't want to do in that way beacause I don't want
    to modify the original xml that i'm inserting!
    In the package dbms_xmlsave I have no ways to change the
    basedir/baseurl
    or to setValidationMode to false like in xmlparser package.
    Is there any way to solve this problem??
    Thank's in advance
    Mauro
    This is an example scratch of my xml doc:
    <?xml version = '1.0' encoding = 'ISO-8859-1'?>
    <!DOCTYPE Segnatura SYSTEM "Segnatura.dtd">
    <Segnatura versione="2001-05-07"
    xmlns:xml="http://www.w3.org/XML/1998/namespace" xml:lang="it">
    </Segnatura>

    Hy Steven, thank's for your attention.
    I'm not using the xsql servlet.
    I'm reading an xml file coming from the file system and I want to
    import it in the db using a java stored proc.
    I also have the dtd file (Segnatura.dtd) but I don't know where
    to put in on the server.
    If I run my java program and I put Segnatura.dtd in the execution
    classpath on the program the xml is loaded fine.
    If I load the stored proc in the db then I don't know where to
    put the dtd. Do I have to put the directory containing the dtd in
    the server classpath and the restart the db maibe?
    thank's
    mauro

  • DBMS_XMLSave issues with different databases

    This is a brainteaser...
    I have set up a couple of stored procedures in a package that inser / update and delete values in a database table using the DBMS_XMLSave functions as per the article 'Using XML-SQL Utility (XSU), 24 of 26' and re-use the context handle.
    This is being used for an ASP application and as such I am using the Oracle 8.1.7 OLEDb provider and passing the XML string as a clob to the stored procedures using a command object.
    I am now moving the application to another database in preparation for it going to staging and have come across a very interesting error. On the old database everything worked correctly, though on this new database (same IIS server) when i try to insert, update or delete on any table using the XML functions i get the following error:
    Unable to insert the details. SQL ERROR:[ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException: Expected name instead of ??.]
    Using the same ASP i connected to the old database and successfully ran the page, i change it to the new database and get the above error.
    However I can successfully execute the stored procedure from a command prompt (TOAD) on the new database.
    I have done some digging and found that it might have something to do with the NLS settings in the database.
    if i change the NLS registry key (HKEY_LOCAL_MACHINE\Software\Oracle\HOME0\NLS_LANG) from AMERICAN_AMERICA.WE8ISO8859P1 to AMERICAN_AMERICA.UTF8 on the IIS server i am running my ASP from, i can get both to return the same error though the question marks turn upside down.
    Here's an example of the sample code i am using. Note how i have to convert a CLOB to a string and back to a CLOB. This was because originally Oracle would not accept CLOBS from ASP (as the createParameter method did not really have a clob datatype but did have a longvarchar though Oracle recognises it as a clob because i can do clob operations on it. If anyone has an idea to get around this could you tell me as well?)
    Here's a snippit of the package i use
    saveCtx := DBMS_XMLSave.newContext('USER_FAVOURITE'); -- create the context once..!
         DBMS_XMLSave.setKeyColumn(saveCtx, 'FAVOURITE_ID'); -- set the key column name.
    PROCEDURE insert_XML(
    o_result OUT NUMBER,
         o_result_msg OUT VARCHAR2,
         xmlDoc in clob
    ) is
    e_processing_error EXCEPTION;
    v_processing_msg VARCHAR2(1990);
    v_result_msg      VARCHAR2(1990);
    insXML           CLOB;
    BEGIN
    -- Create a temp LOB as an input parameter
    DBMS_LOB.CREATETEMPORARY(insXML,TRUE);
    -- Write the XML doc to the LOB
    DBMS_LOB.WRITE(insXML, DBMS_LOB.GETLENGTH(xmlDoc), 1, DBMS_LOB.SUBSTR(xmlDoc, 32767));
    rows := DBMS_XMLSave.insertXML(saveCtx, insXML);
    -- Free the LOB space in memory
    DBMS_LOB.FREETEMPORARY(insXML);
    END;

    XSU don't suppose to support databases other than Oracle.

  • Error when using DBMS_XMLSave package

    Hi,
    I am a novice at XML technology. And although I have picked up on the basics, please do bear with my questions. My requirement is that we are receiving XML files in a particular format (as below), which I need to load into Oracle tables.
    <?xml version="1.0"?>
    <Root_Element>
         <Examinee>
              <MACode>A</MACode>
              <TestingJID>TN</TestingJID>
              <ExamineeID>100001</ExamineeID>
              <CreateDate>20020221</CreateDate>
              <Demographic>
                   <InfoDate>20020221</InfoDate>
                   <FirstTime>1</FirstTime>
                   <LastName>JANE</LastName>
                   <FirstName>DOE</FirstName>
                   <MiddleInitial>C</MiddleInitial>
                   <LithoNumber>73</LithoNumber>
                   <IdType>1</IdType>
                   <IdNumber>30738</IdNumber>
                   <DOB>19630525</DOB>
                   <EthnicCode>1</EthnicCode>
                   <GenderCode>2</GenderCode>
                   <MilitaryCode/>
                   <MSCode/>
                   <RFT01>1</RFT01>
                   <RFT02></RFT02>
                   <RFT03></RFT03>
                   <RFT17></RFT17>
                   <StreetAddress>SomeAddress</StreetAddress>
                   <City>SomeCity</City>
                   <StateCode>TN</StateCode>
                   <ZipCode>37000</ZipCode>
                   <EdLevel>8</EdLevel>
                   <SU01> </SU01>
                   <SU02> </SU02>
                   <SU03> </SU03>
                   <SU04> </SU04>
                   <TestCenterCode>34</TestCenterCode>
                   <PassStatus>1</PassStatus>
                   <CompleteStatus>1</CompleteStatus>
                   <CompleteDate>20020221</CompleteDate>
                   <TotStdScore>268</TotStdScore>
                   <AvgStdScore>53.6</AvgStdScore>
                   <CredJID>TN</CredJID>
                   <CredStatus>1</CredStatus>
                   <CredNbr>100001</CredNbr>
                   <CredDate>20020310</CredDate>
              </Demographic>
              <Test>
                   <TestDate>20020221</TestDate>
                   <TestNbr>1</TestNbr>
                   <SrlNbr>13773784</SrlNbr>
                   <Fmt>3</Fmt>
                   <Frm>23</Frm>
                   <Raw>47</Raw>
                   <Top>10</Top>
                   <RN1>30</RN1>
                   <RN2>35</RN2>
                   <RN3></RN3>
                   <RS1>4</RS1>
                   <RS2>4</RS2>
                   <RS3></RS3>
                   <ESY>8</ESY>
                   <Std>58</Std>
                   <Rnk>81</Rnk>
                   <FErr>0</FErr>
                   <EErr>0</EErr>
                   <MErr>0</MErr>
                   <JErr>0</JErr>
                   <AErr>0</AErr>
                   <QErr>0</QErr>
                   <Best>1</Best>
                   <Inactive>0</Inactive>
                   <Response>4,4,4,2,2,5,1,1,2,4,5,5,5,1,3,1,5,4,1,1,5,3,1,3,5,4,4,4,4,3,1,4,1,1,3,4,2,4,4,3,1,1,4,5,4,3,1,2,4,1, , , , , </Response>
              </Test>
              <Test>
                   <TestDate>20020221</TestDate>
                   <TestNbr>2</TestNbr>
                   <SrlNbr>13773784</SrlNbr>
                   <Fmt>3</Fmt>
                   <Frm>23</Frm>
                   <Raw>46</Raw>
                   <Std>53</Std>
                   <Rnk>67</Rnk>
                   <FErr>0</FErr>
                   <EErr>0</EErr>
                   <MErr>0</MErr>
                   <JErr>0</JErr>
                   <AErr>0</AErr>
                   <QErr>0</QErr>
                   <Best>1</Best>
                   <Inactive>0</Inactive>
                   <Response>5,3,5,3,2,4,3,4,3,3,2,4,3,2,2,3,2,2,2,3,1,4,3,5,4,3,1,1,2,1,2,4,5,5,2,5,4,5,4,1,3,2,1,4,1,3,2,4,2,1,1,1,4,4,5,2,3,2,1, , , , , </Response>
              </Test>
         </Examinee>
    </Root_Element>
    We will be creating new tables, so taking into account the nested structures we decided to go the object-relational route. The "Examinee" is on the higher level with a single "Demographic" and multiple "Test" under it. This is what we have created.
    create or replace type DEMOGRAPHIC_TY as object (
    InfoDate     VARCHAR2(50),
    FirstTime     VARCHAR2(50),
    LastName     VARCHAR2(50),
    FirstName     VARCHAR2(50),
    MiddleInitial     VARCHAR2(50),
    LithoNumber     VARCHAR2(50),
    IdType          VARCHAR2(50),
    IdNumber     VARCHAR2(50),
    DOB          VARCHAR2(50),
    EthnicCode     VARCHAR2(50),
    GenderCode     VARCHAR2(50),
    MilitaryCode     VARCHAR2(50),
    MSCode          VARCHAR2(50),
    RFT01          VARCHAR2(50),
    RFT02          VARCHAR2(50),
    RFT03          VARCHAR2(50),
    RFT17          VARCHAR2(50),
    StreetAddress     VARCHAR2(50),
    City          VARCHAR2(50),
    StateCode     VARCHAR2(50),
    ZipCode          VARCHAR2(50),
    EdLevel          VARCHAR2(50),
    SU01          VARCHAR2(50),
    SU02          VARCHAR2(50),
    SU03          VARCHAR2(50),
    SU04          VARCHAR2(50),
    TestCenterCode     VARCHAR2(50),
    PassStatus     VARCHAR2(50),
    CompleteStatus     VARCHAR2(50),
    CompleteDate     VARCHAR2(50),
    TotStdScore     VARCHAR2(50),
    AvgStdScore     VARCHAR2(50),
    CredJID          VARCHAR2(50),
    CredStatus     VARCHAR2(50),
    CredDate     VARCHAR2(50),
    CredNbr          VARCHAR2(50));
    create or replace type TEST_TY as object (
    TestDate     VARCHAR2(50),
    TestNbr          VARCHAR2(50),
    SrlNbr          VARCHAR2(50),
    Fmt          VARCHAR2(50),
    Frm          VARCHAR2(50),
    "Raw"          VARCHAR2(50),
    Top          VARCHAR2(50),
    RN1          VARCHAR2(50),
    RN2          VARCHAR2(50),
    RN3          VARCHAR2(50),
    RS1          VARCHAR2(50),
    RS2          VARCHAR2(50),
    RS3          VARCHAR2(50),
    ESY          VARCHAR2(50),
    Std          VARCHAR2(50),
    Rnk          VARCHAR2(50),
    FErr          VARCHAR2(50),
    EErr          VARCHAR2(50),
    MErr          VARCHAR2(50),
    JErr          VARCHAR2(50),
    AErr          VARCHAR2(50),
    QErr          VARCHAR2(50),
    Best          VARCHAR2(50),
    Inactive     VARCHAR2(50),
    Response     VARCHAR2(100));
    create or replace type TEST_NT as table of TEST_TY;
    create table EXAMINEE (
    MACode          VARCHAR2(50),
    TestingJID     VARCHAR2(50),
    ExamineeID     VARCHAR2(50),
    CreateDate     VARCHAR2(50),
    Demographic     DEMOGRAPHIC_TY,
    Test          TEST_NT)
    nested table Test store as Test
    CREATE DIRECTORY XML_DIR AS 'C:\TestXML';
    CREATE TABLE XML_TEMP (key NUMBER, f_lob BFILE);
    INSERT INTO XML_TEMP VALUES (1,BFILENAME('XML_DIR','M01.XML'));
    And this is the procedure,
    CREATE OR REPLACE PROCEDURE loadxml AS
    insCtx sys.DBMS_XMLSave.ctxType;
    rows number;
    fil BFILE;
    buffer RAW(32767);
    len INTEGER;
    insrow INTEGER;
    BEGIN
    SELECT f_lob INTO fil FROM xml_temp WHERE key = 1;
    DBMS_LOB.FILEOPEN(fil,DBMS_LOB.FILE_READONLY);
    len := DBMS_LOB.GETLENGTH(fil);
    DBMS_LOB.READ(fil,len,1,buffer);
    insCtx := sys.DBMS_XMLSave.newContext('examinee'); -- get the context handle
    rows := sys.DBMS_XMLSave.insertXML(insCtx,buffer); -- this inserts the document
    sys.DBMS_XMLSave.closeContext(insCtx); -- this closes the handle
    IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    DBMS_LOB.FILECLOSE(fil);
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('In Exception');
    DBMS_OUTPUT.PUT_LINE(SQLERRM(SQLCODE));
    IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    DBMS_LOB.FILECLOSE(fil);
    END IF;
    end;
    And when I execute this, it gives an error,
    In Exception
    ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException: Start of root element expected.
    I have tried to follow the XML Developer Guide as much possible, but might be missing something.
    H E L P !!!!
    Thanks.

    When I try the describe, it says object not found. If I go into OEM, I don't see that package either. Again, I didn't create that database, but I thought the XML DB stuff was installed by default with the database. Is there a way to add that package after the database is created?
    Thanks,
    Andrew

  • Using dbms_xmlsave

    I am trying to save contents of xml file into database tables. I know I have to use dbms_xmlsave.insertxml, but it does not allow you to work with multiple tables, so I created a view to join 2 tables together. But when I try to insert into the view I get this error:
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException: Exception
    'oracle.jdbc.driver.OracleSQLException:ORA-01732: data manipulation operation
    not legal on this view
    ' encountered during processing ROW element 1All prior XML row changes were
    rolled back. in the XML document.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 91
    ORA-06512: at line 31
    My xmldatagram looks like this:
    <?xml version = "1.0"?>
    <warranty_claim>
    <ROW>
    <customer_claim_no>12345</customer_claim_no>
    <claim_date>2003-SEP-24</claim_date>
    <repair_shop_site_name>test supplier</repair_shop_site_name>
    <failed_part_no>12345</failed_part_no>
    <other_part>
    <other_part_item>
    <customer_claim_no>12345</customer_claim_no>
    <part_no>54321</part_no>
    <unit_price>10.2</unit_price>
    <quantity>10</quantity>
    <total_price>102</total_price>
    </other_part_item>
    <other_part_item>
    <customer_claim_no>12345</customer_claim_no>
    <part_no>98767</part_no>
    <unit_price>20.2</unit_price>
    <quantity>10</quantity>
    <total_price>202</total_price>
    </other_part_item>
    </other_part>
    </ROW>
    </warranty_claim>
    create or replace type ph_other_part as object(
    customer_claim_no varchar2(100),
    part_id number,
    part_no varchar2(100),
    description varchar2(100),
    unit_price number,
    quantity number,
    total_price number,
    part_failed varchar2(100))
    create or replace type ph_othpart_tab as table of ph_other_part
    create or replace view ph_wc_view
    as select customer_claim_no,
    claim_date,
    repair_shop_site_name,
    failed_part_no,
    CAST(MULTISET(select customer_claim_no,
    part_id,
    part_no,
    description,
    unit_price,
    quantity,
    total_price,
    part_failed
    from ph_wc_part pwp
    where pwp.customer_claim_no = pwc.customer_claim_no
    ) AS sys.ph_othpart_tab ) other_part
    from ph_warranty_claim pwc
    main script
    declare
    insCtx dbms_xmlsave.ctxType;
    rowcount number:=0;
    v_tablename varchar2(100):='ph_wc_view';
    xmldoc clob;
    errorNum number;
    errorMsg varchar2(200);
    begin
    begin
    select data
    into xmldoc
    from cic.cic_temp
    where data_id = 2;
    exception when others then
    dbms_output.put_line('Error getting xmldoc. '||sqlerrm(sqlcode));
    end;
    insCtx := dbms_xmlsave.newcontext(v_tablename);
    dbms_xmlsave.setIgnoreCase(insCtx,1);
    dbms_xmlsave.clearupdatecolumnlist(insCtx);
    dbms_xmlsave.setupdatecolumn(insCtx,'customer_claim_no');
    dbms_xmlsave.setupdatecolumn(insCtx,'claim_date');
    dbms_xmlsave.setupdatecolumn(insCtx,'repair_shop_site_name');
    dbms_xmlsave.setupdatecolumn(insCtx,'failed_part_no');
    dbms_xmlsave.setupdatecolumn(insCtx,'other_part');
    rowcount := dbms_xmlsave.insertXML(insCtx,xmldoc);
    dbms_xmlsave.closecontext(insCtx);
    commit;
    dbms_output.put_line('Rows inserted: '||rowcount);
    end;

    Hi,
    For your XML file I think you just need to enclose XML elemnts in ROWSET AND ROW TAGS - so xml should look like :
    <ROWSET>
    <ROW>
    <DEPT>
    </DEPT>
    and just pass it as CLOB to dbms_xmlsave.insertXML proc.
    I hope it should work.
    I am also trying to insert XML file but with a bit complex structure having multiple nested elements.
    I am not sure how to transform the external XML file to wrap it in ROWSET/ROW using XSLT. It's mandatory to use ROWSET/ROW tags to be able to insert in oracle tables. I am facing this problem right now. I am using object views to accomplish the purpose but still needs to figure out the way to apply stylesheet to incoming XML file.
    If you come to know of any way, pls do let me know also.
    Thanks

  • Dbms_xmlsave Error line 65

    We are passing a clob to dbms_xmlsave.insertxml successfully for all XML clobs under .5 megs but once we go over that size the Error line 65 "Invalid arguments encountered processing ROW ELEMENT 0 show up. Is this a size limitation for dbms_xmlsave? Is there an approach that can handle clobs over .5 meg?

    Looks like XDB is not installed. You can verify this by doing desc RESOURCE_VIEW. If RESOURCE_VIEW does not exist then you need to install XDB to install the dbms_xmlstore() package
    You need to run the script catqm in $ORACLE_HOME/rdbms/admin. This will add the DBMS_XMLSTORE package. catqm takes 3 arguments. The XDB password, typically XDB, the tablespace to be used for the XDB repository and the name of the temporay tablespace to be used by XDB. Once this has been run DBMS_XMLSTORE() should be there.
    Once XDB has been installed you should get the following:
    SQL> desc dbms_xmlstore
    PROCEDURE CLEARKEYCOLUMNLIST
    Argument Name                  Type                    In/Out Default?
    CTXHDL                         NUMBER                  IN
    PROCEDURE CLEARUPDATECOLUMNLIST
    Argument Name                  Type                    In/Out Default?
    CTXHDL                         NUMBER                  IN
    PROCEDURE CLOSECONTEXT
    Argument Name                  Type                    In/Out Default?
    CTXHDL                         NUMBER                  IN
    FUNCTION DELETEXML RETURNS NUMBER
    Argument Name                  Type                    In/Out Default?
    CTXHDL                         NUMBER                  IN
    XDOC                           VARCHAR2                IN
    FUNCTION DELETEXML RETURNS NUMBER
    Argument Name                  Type                    In/Out Default?
    CTXHDL                         NUMBER                  IN
    XDOC                           CLOB                    IN
    FUNCTION DELETEXML RETURNS NUMBER
    Argument Name                  Type                    In/Out Default?
    CTXHDL                         NUMBER                  IN
    XDOC                           XMLTYPE                 IN
    FUNCTION INSERTXML RETURNS NUMBER
    Argument Name                  Type                    In/Out Default?
    CTXHDL                         NUMBER                  IN
    XDOC                           VARCHAR2                IN
    FUNCTION INSERTXML RETURNS NUMBER
    Argument Name                  Type                    In/Out Default?
    CTXHDL                         NUMBER                  IN
    XDOC                           CLOB                    IN
    FUNCTION INSERTXML RETURNS NUMBER
    Argument Name                  Type                    In/Out Default?
    CTXHDL                         NUMBER                  IN
    XDOC                           XMLTYPE                 IN
    FUNCTION NEWCONTEXT RETURNS NUMBER
    Argument Name                  Type                    In/Out Default?
    TARGETTABLE                    VARCHAR2                IN
    PROCEDURE SETKEYCOLUMN
    Argument Name                  Type                    In/Out Default?
    CTXHDL                         NUMBER                  IN
    COLNAME                        VARCHAR2                IN
    PROCEDURE SETROWTAG
    Argument Name                  Type                    In/Out Default?
    CTX                            NUMBER                  IN
    ROWTAGNAME                     VARCHAR2                IN
    PROCEDURE SETUPDATECOLUMN
    Argument Name                  Type                    In/Out Default?
    CTXHDL                         NUMBER                  IN
    COLNAME                        VARCHAR2                IN
    FUNCTION UPDATEXML RETURNS NUMBER
    Argument Name                  Type                    In/Out Default?
    CTXHDL                         NUMBER                  IN
    XDOC                           VARCHAR2                IN
    FUNCTION UPDATEXML RETURNS NUMBER
    Argument Name                  Type                    In/Out Default?
    CTXHDL                         NUMBER                  IN
    XDOC                           CLOB                    IN
    FUNCTION UPDATEXML RETURNS NUMBER
    Argument Name                  Type                    In/Out Default?
    CTXHDL                         NUMBER                  IN
    XDOC                           XMLTYPE                 IN
    SQL>
    Message was edited by:
    mdrake

Maybe you are looking for

  • Difficulty Defining WSDL

    Hi guys, My work has come to a bit of a stand still because I am trying to define a complex data type that I cannot seem to describe in a wsdl. I'm new to web services so I bear with me if this doesn't come out right. I'm using axis2 to build my web

  • ACS 4.0 and RSA Token Server problem

    Hi, We are having a problem trying to get ACS 4.0 for Windows to authenticate wireless users on an RSA Token server. Our Cisco 1200 series AP is configured for WPA2 and LEAP authentication. It points at the ACS server for RADIUS authentication. Now t

  • Wht changes is to be done in XI while moving to ECC 5.0 to ECC 6.0

    Hi Experts, In my project client has implemented ECC 5.0 and now they are moving to ECC 6.0 ,so what are changes is to be done in XI in (DEV ,QA,PROD) when our ECC5.0 move to ECC 6.0.

  • Help! iPhone 4s in Recovery Mode after new IOS 7.1.1 update.

    I went to update my iphone 4s earlier to IOS 7.1.1 and now it's in recovery mode. My issue with that is I keep trying to download the update on my computer so it can do the recovery and every time it gets to fully download (which bc I have a ****** i

  • Error message "unsupported file type"

    I know I saw this topic before, but never saw an answer. I am using mpeg streamclip...can convert all .vob files to .dv but cannot do the 1st .vob file and it is part of the home movie! I get the error message "unsupported file type". I don't have a