Home » Developer & Programmer » JDeveloper, Java & XML » XML error
icon5.gif  XML error [message #152176] Wed, 21 December 2005 08:57 Go to next message
dasbot
Messages: 2
Registered: December 2005
Junior Member
Hi
ex1.
SQL> drop table my_clob_table;

Table dropped.

SQL> create table my_clob_table(ID number,MY_CLOB clob);

Table created.

SQL> declare
  2  qryCtx dbms_xmlgen.ctxHandle; 
  3  result clob;
  4  savCtx DBMS_XMLSTORE.ctxType;
  5  n number;
  6  begin
  7   result:='
  8          <ROWSET>
  9           <ROW>
 10            <ID>123</ID>
 11            <MY_CLOB>'||LPAD('F',32000,'F')||'</MY_CLOB>
 12           </ROW>
 13          </ROWSET>';
 14   savCtx := DBMS_XMLSTORE.newContext('my_clob_table');
 15   DBMS_XMLSTORE.clearUpdateColumnList(savCtx); 
 16   DBMS_XMLSTORE.SetUpdateColumn (savCtx, 'ID');
 17   DBMS_XMLSTORE.SetUpdateColumn (savCtx, 'MY_CLOB');
 18   n:=DBMS_XMLSTORE.insertxml(savCtx,result);
 19   DBMS_XMLSTORE.closeContext(savCtx);
 20  end;
 21  /

PL/SQL procedure successfully completed.

ex2.
SQL> drop table my_blob_table;

Table dropped.

SQL> create table my_blob_table(ID number,MY_BLOB blob);

Table created.

SQL> declare
  2  qryCtx dbms_xmlgen.ctxHandle; 
  3  result clob;
  4  savCtx DBMS_XMLSTORE.ctxType;
  5  n number;
  6  begin
  7   result:='
  8          <ROWSET>
  9           <ROW>
 10            <ID>123</ID>
 11            <MY_BLOB>'||LPAD('F',32000,'F')||'</MY_BLOB>
 12           </ROW>
 13          </ROWSET>';
 14   savCtx := DBMS_XMLSTORE.newContext('my_blob_table');
 15   DBMS_XMLSTORE.clearUpdateColumnList(savCtx); 
 16   DBMS_XMLSTORE.SetUpdateColumn (savCtx, 'ID');
 17   DBMS_XMLSTORE.SetUpdateColumn (savCtx, 'MY_BLOB');
 18   n:=DBMS_XMLSTORE.insertxml(savCtx,result);
 19   DBMS_XMLSTORE.closeContext(savCtx);
 20  end;
 21  /
declare
*
ERROR at line 1:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00222: error received from SAX callback function
ORA-06512: at "SYS.DBMS_XMLSTORE", line 78
ORA-06512: at line 18


why example 2 is wrong?

Re: XML error [message #152228 is a reply to message #152176] Wed, 21 December 2005 15:22 Go to previous messageGo to next message
mchadder
Messages: 224
Registered: May 2005
Location: UK
Senior Member
Hello.

For the same reason that this fails :
SQL> insert into my_blob_table values ( 123, 'xxx');
insert into my_blob_table values ( 123, 'xxx')
                                        *
ERROR at line 1:
ORA-01465: invalid hex number

Don't forget that you are trying to insert character data directly
into a BLOB, and you just can't do that.

Rgds
Re: XML error [message #152242 is a reply to message #152228] Wed, 21 December 2005 17:40 Go to previous messageGo to next message
dasbot
Messages: 2
Registered: December 2005
Junior Member
ок

1.
SQL> insert into my_blob_table values ( 123, 'FFF');
     PL/SQL procedure successfully completed.


F - HEX

2.
SQL> drop table my_blob_table;

Table dropped.

SQL> create table my_blob_table(ID number,MY_BLOB blob);

Table created.

SQL> declare
  2  qryCtx dbms_xmlgen.ctxHandle; 
  3  result clob;
  4  savCtx DBMS_XMLSTORE.ctxType;
  5  n number;
  6  begin
  7   result:='
  8          <ROWSET>
  9           <ROW>
 10            <ID>123</ID>
 11            <MY_BLOB>'||LPAD('F',4000,'F')||'</MY_BLOB>
 12           </ROW>
 13          </ROWSET>';
 14   savCtx := DBMS_XMLSTORE.newContext('my_blob_table');
 15   DBMS_XMLSTORE.clearUpdateColumnList(savCtx); 
 16   DBMS_XMLSTORE.SetUpdateColumn (savCtx, 'ID');
 17   DBMS_XMLSTORE.SetUpdateColumn (savCtx, 'MY_BLOB');
 18   n:=DBMS_XMLSTORE.insertxml(savCtx,result);
 19   DBMS_XMLSTORE.closeContext(savCtx);
 20  end;
 21  /
    PL/SQL procedure successfully completed.

If FFFFF....F<=4000 then ok
if >4000 then error

????????
Re: XML error [message #152243 is a reply to message #152176] Wed, 21 December 2005 17:53 Go to previous message
mchadder
Messages: 224
Registered: May 2005
Location: UK
Senior Member
Yep, quite right, couldn't see the wood for the trees on that one. Wink

I think that's a bug, there's a bug which was fixed in 10.2 with regards to CLOBs being > 4000 characters, i.e.

metalink link
, looks like you're hitting a BLOB version of it....

I'd probably log a TAR on that one...

Rgds
Previous Topic: How to pass an array from Java which maps to a PL/SQL table in oracle?
Next Topic: Uploading Master-Detail data from XML file to Oracle tables
Goto Forum:
  


Current Time: Mon Nov 25 00:29:57 CST 2024