DBMS_METADATA.GET_DDL or GET_XML Returns Error ORA-6502 (Doc ID 552661.1)

Last updated on NOVEMBER 28, 2016

Applies to:

Oracle Server - Enterprise Edition - Version: to
This problem can occur on any platform.


You try to collect the metadata for a table with function DBMS_METADATA.GET_DDL (or GET_XML). This returns the errors:

SQL> set long 100000
SQL> select dbms_metadata.get_ddl ('TABLE', 'TAB001', 'TEST') from dual;
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "SYS.DBMS_METADATA", line 2681
ORA-06512: at "SYS.DBMS_METADATA", line 2732
ORA-06512: at "SYS.DBMS_METADATA", line 4333
ORA-06512: at line 1

You verified the components status (in view DBA_REGISTRY) or searched for INVALID objects (in view DBA_OBJECTS) but the data dictionary is clean: no invalid components or objects.


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