Reputation: 10106
What i am trying to do
I am trying to create a procedure which accepts table_name as its parameter. And inside the procedure i am dynamically dropping the table using Dynamic SQL
What is the problem
After calling the procedure by writing execute droptab('TEST');
i get the following error:
ERROR at line 1:
ORA-00950: invalid DROP option
ORA-06512: at "SYSTEM.DROPTAB", line 4
ORA-06512: at line 1
Procedure
create or replace procedure dropTab (tableName in varchar2) is
begin
EXECUTE IMMEDIATE 'DROP TABLE' || tableName;
end;
/
Upvotes: 1
Views: 871
Reputation: 59997
Change
'DROP TABLE'
to
'DROP TABLE '
I.e. add an additional space
Upvotes: 4