My Oracle Support Banner

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

Last updated on JANUARY 16, 2020

Applies to:

Oracle Database - Enterprise Edition - Version to [Release 9.2 to 11.1]
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Information in this document applies to any platform.
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.




To view full details, sign in with your My Oracle Support account.

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

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.