Execute Immediate - Drop table
627574Jan 9 2010 — edited Jan 9 2010Hi,
I have a piece of code which accepts table name as an input parameter and drop the table using, dynamic SQL. The code follows below:
create or replace procedure drop_table(in_table_name in varchar2)
as
sql_stmt varchar2(25);
begin
dbms_output.put_line('Table name that has to be dropped is: '|| in_table_name);
sql_stmt := 'drop table ' || in_table_name;
execute_immediate sql_stmt;
end;
/
When I am trying to compile this procedure, i am getting compilation errors.
Can we use execute immediate to drop the tables inside PL/SQL code.
Kindly help.
Thanks in advance
Raghu