Dbms_xmlstore Insertxml Throws ORA-01008 For CLOB Column With Null Value (Doc ID 1270580.1)

Last updated on FEBRUARY 08, 2017

Applies to:

Oracle XML Developers Kit - Version 10.2.0.5 to 11.2.0.2 [Release 10.2 to 11.2]
Information in this document applies to any platform.
***Checked for relevance on 03-Dec-2012***

Symptoms

Inserting XML document into a table columns using DBMS_XMLSTORE.

The table has a CLOB column . Inserting NULL data into CLOB column fails with ORA-01008

set serveroutput on
DECLARE
lv_context DBMS_XMLSTORE.ctxtype;
p_guests_xml CLOB;
p_guests_attendance_xml CLOB;
lv_rows NUMBER;
BEGIN
dbms_output.put_line('hi there ');
p_guests_attendance_xml :=
'<ROWSET><ROW><WERGATD_T_COMMENT></WERGATD_T_COMMENT><WERGATD_T_FUNC_CODE>FASE
T-GDIS</WERGATD_T_FUNC_CODE><WERGATD_T_GUEST_SEQ_NO>0</WERGATD_T_GUEST_SEQ_NO>
</ROW></ROWSET>';
IF length(p_guests_attendance_xml) > 0 THEN
dbms_output.put_line('in if');
lv_context := DBMS_XMLSTORE.NEWCONTEXT('SC_WERGATD_TEMP');
dbms_output.put_line('insert');
lv_rows := DBMS_XMLSTORE.INSERTXML(lv_context,
p_guests_attendance_xml);
dbms_output.put_line('close contxt');
DBMS_XMLSTORE.CLOSECONTEXT(lv_context);
END IF;
dbms_output.put_line('Done ......');
END;
/

 

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-01008: not all variables bound
ORA-24801: illegal parameter value in OCI lob function
ORA-24801: illegal parameter value in OCI lob function
ORA-06512: at "SYS.DBMS_XMLSTORE", line 78
ORA-06512: at line 13



Error seems to occur only when inserting NULL data into CLOB but works
fine even when inserting NULL data into VARCHAR2 column.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms