sql – why an oracle procedure is invalid – Education Career Blog

Can someone please explain to me why I keep getting this PLS-00905 error for the below simple procedure? Thank you.

create or replace procedure copy_table(
    table_name IN varchar2, 
    database_link IN varchar2, 
    suffix IN varchar2, 
    table_owner IN varchar2)
IS
begin
    execute immediate 'create table ' || table_name || '_' || suffix || 
    ' as select * from ' || table_owner || '.' || table_name || '@' || database_link ;
end;
/


SQL> execute myschema.copy_table;
BEGIN myschema.copy_table; END;
              *
ERROR at line 1:
ORA-06550: line 1, column 15:
PLS-00905: object myschema.copy_table is invalid
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

,

Get rid of the trailing slash – that’s for SQLPlus command termination

Leave a Comment