Cast null CLOB to null XMLType ?
452507Sep 29 2006 — edited Nov 30 2006I want to insert more than 4k of XML data into an XML column. The Oracle docs say I have to pass this as a CLOB variable, and cast the variable as XMLTYPE on the server
http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb11jav.htm#sthref1443
This all works OK - except when the CLOB value is null, which causes this error:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.XMLTYPE", line 254
I can get the same error using this:
DECLARE
v_CLOB CLOB;
v_XML XMLTYPE;
BEGIN
v_CLOB := null;
SELECT (XMLTYPE(v_CLOB)) into v_XML FROM DUAL;
END;
So, should I be able to cast a null CLOB to a null XMLType ? Or do I have to handle this all myself - and if so, what's the best way to do this ?
Thanks,
Andy.
10.2.0.1 64bit RedHat Linux.