Hi everyone,
I developed a database procedure called PR_RECUPERAR_DDL_V2 with the following code:
CREATE OR REPLACE PROCEDURE BD_AUDIT_DDL.PR_RECUPERAR_DDL_V2(P_OBJ_TYPE VARCHAR2,
P_OBJ_NAME VARCHAR2,
P_OBJ_OWNER VARCHAR2,
P_DDL OUT CLOB) IS
BEGIN
SELECT SYS.DBMS_METADATA.GET_DDL (object_type => P_OBJ_TYPE, NAME=>P_OBJ_NAME, SCHEMA=>P_OBJ_OWNER)
INTO P_DDL
FROM DUAL;
END PR_RECUPERAR_DDL_V2;
/
It is a very simple code.
When I call the procedure and passing the correct parameters, it raised the following error:
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Dec 29 11:46:50 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> DECLARE
V_SQL_ORIGEM CLOB;
BEGIN
BD_AUDIT_DDL.PR_RECUPERAR_DDL_V2('TABLE','CK_LOG','BD_SPL', V_SQL_ORIGEM);
END;
/ 2 3 4 5 6
DECLARE
*
ERROR at line 1:
ORA-31603: object "CK_LOG" of type TABLE not found in schema "BD_SPL"
ORA-06512: at "SYS.DBMS_METADATA", line 5805
ORA-06512: at "SYS.DBMS_METADATA", line 8344
ORA-06512: at line 1
ORA-06512: at "BD_AUDIT_DDL.PR_RECUPERAR_DDL_V2", line 8
ORA-06512: at line 4
Anyone has any idea what it is causing the error?