XMLCDATA SQL Function Fails with ORA-22835 for Strings > 4000 CHAR

(Doc ID 1512017.1)

Last updated on FEBRUARY 08, 2017

Applies to:

Oracle Server - Enterprise Edition - Version 9.2.0.2 to 10.2.0.5.0 [Release 9.2 to 10.2]
Information in this document applies to any platform.

Symptoms

XMLCDATA SQL Function Fails with ORA-22835 for Strings > 4000 CHAR.

e.g.

SQL> declare
   mycdata clob;
   asxml   xmltype;
begin
   mycdata := lpad('X', 4000, 'X') || lpad('X', 4000, 'X');
   select xmlcdata(mycdata) into asxml from dual;
end;
/
declare
*
ERROR at line 1:
ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 8000, maximum: 4000)
ORA-6512: at line 6

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