Calling Dbms_metadata.Get_ddl From Stored Procedure Results In Ora-31603 (Doc ID 463483.1)

Last updated on JANUARY 12, 2017

Applies to:

Oracle Database - Enterprise Edition - Version 9.2.0.1 and later
Information in this document applies to any platform.

Symptoms

Calling dbms_metadata.get_ddl from a stored procedure to get the DDL of an object in another schema raises the following error:

ERROR at line 1:
ORA-31603: object <Object Name> of type <Object Type> not found in schema <Schema Name>
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 2805
ORA-06512: at "SYS.DBMS_METADATA", line 4333
ORA-06512: at line 1
ORA-06512: at <Stored Procedure Name>, line 16
ORA-06512: at line 1


Calling the dbms_metadata.get_ddl directly from sql*plus on the same object works fine.

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