Showing posts with label DBMS_XMLSTORE. Show all posts
Showing posts with label DBMS_XMLSTORE. Show all posts

Wednesday, July 09, 2008

DBMS_XMLSTORE and LPX-00222: error received from SAX callback function

Always check out the original article at http://www.oraclequirks.com for latest comments, fixes and updates.

You may see the following stack of errors
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 "TEST.INSERTXML", line 28
ORA-06512: at line 1
in an attempt of:
  1. using DBMS_XMLSTORE.INSERTXML (prior to version 10GR2) for loading a document containing an apostrophe ('). The error is raised regardless of the representation of the apostrophe ( ' or as ' or ') and is filed as a bug in metalink.
  2. using DBMS_XMLSTORE.INSERTXML for loading a document into a table whose columns have NOT NULL constraints, no default value and the corresponding element(s) in the document present at least one empty field. This holds also for documents containing a subset of the columns of the table and one of the missing columns is mandatory.
  3. using DBMS_XMLSTORE.INSERTXML for loading a document into a table with primary, unique or foreign keys and the data being loaded violates one or more constraints.
  4. using DBMS_XMLSTORE.INSERTXML for loading a document into a table with insufficient column size. For instance, a document containing strings larger than the target table column can hold.
Most likely there are more situations involving other procedures in the DBMS_XMLSTORE package that i hadn't the time to investigate yet.
In other words, this LPX-00222 error is a sort of catch-all exception, which means that you'll have to go through the pesky job of identifying the offending element(s) in your source XML file manually.
For large files this can really turn into a nightmare, indeed initially i wasted several hours trying to load an XML containing an apostrophe before realizing that this was a known bug of 10GR1.

See message translations for LPX-00222 and search additional resources.

Monday, July 07, 2008

Interesting change in the XML export format of Oracle SQLDeveloper

Always check out the original article at http://www.oraclequirks.com for latest comments, fixes and updates.

In the last days I've been playing with XML files using SQL Developer and other tools and i noticed the following interesting change in the behavior of SQL Developer when it comes to exporting the data from a table in XML format:

until version 1.5.0 build 5338, the elements in the XML file when exporting table were (in XPath notation format):
results/row/COLUMN NAME (note the mixture of lower and upper case, where COLUMN NAME was the relevant column name.

From version 1.5.1 build 5440, the element names have been changed and are now more consistent:
RESULTS/ROW/COLUMN@NAME="COLUMN NAME" (where COLUMN is now a fixed element whose NAME attribute contains the actual column name.

I've been lazily checking the release notes but could not find anything on this interesting change, but it could be that i didn't notice it.

Note that this new format is not the DBMS_XMLGEN canonical format (as it wasn't the previous one either).

DBMS_XMLGEN canonical format is:
ROWSET/ROW/COLUMN NAME

You can download and use the following XSL stylesheet (SQLDEV2APEX.XSL) to convert from this new format to the DBMS_XMLGEN canonical format, in case you wish to use the exported file to load a table using DBMS_XMLSTORE or through Oracle Application Express (Apex) Data Load page.

yes you can!

Two great ways to help us out with a minimal effort. Click on the Google Plus +1 button above or...
We appreciate your support!

latest articles