Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Execute Immediate - Drop table

627574Jan 9 2010 — edited Jan 9 2010
Hi,

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
This post has been answered by Hoek on Jan 9 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 6 2010
Added on Jan 9 2010
4 comments
11,972 views