Martin08
Martin08

Reputation: 21450

why an oracle procedure is invalid

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

Upvotes: 3

Views: 5975

Answers (1)

OMG Ponies
OMG Ponies

Reputation: 332681

Get rid of the trailing slash - that's for SQLPlus command termination

Upvotes: 3

Related Questions