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!

Droping a table from a Procedure by passing Table Name as Argument

1044098Oct 24 2014 — edited Oct 24 2014

Hii All

I want to drop a table from a procedure dynamically passing table name as in mode parameter from a procedure

for that i have written the following procedure

CREATE OR REPLACE PROCEDURE DEL_TAB(TAB_NAME IN VARCHAR2) AS

V_TAB_NAME VARCHAR2(10);

V_STMT VARCHAR2(50);

BEGIN

V_TAB_NAME:=TAB_NAME;

V_STMT:='DROP TABLE '||V_TAB_NAME;

EXECUTE IMMEDIATE 'V_STMT';

DBMS_OUTPUT.PUT_LINE(V_TAB_NAME||' TABLE DELETED');

END DEL_TAB;

but when ever i am executing it it is giving me some error

ERROR at line 1:

ORA-06550: line 1, column 15:

PLS-00357: Table,View Or Sequence reference 'A' not allowed in this context

ORA-06550: line 1, column 7:

PL/SQL: Statement ignored

Please Tell me the solution.....

Thanks in Advance

Nitish

This post has been answered by Karthick2003 on Oct 24 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 21 2014
Added on Oct 24 2014
7 comments
161 views