Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL question
>Can any one tell me what I'm missing here? The following code causes the
>PL/SQL compiler (interpreter?) to complain that I have supplied an invalid
>table name. However, it appears as though the table name is valid when I
>examine the run-time variables.
>
> execute immediate 'drop table :1' using x;
> execute immediate 'drop table :2' using y;
>
>
You can't do a drop table like that in pl/sql. Try generating this procedure:
CREATE OR REPLACE procedure execddl (s1 varchar2) as
cursor1 integer;
begin
cursor1 := dbms_sql.open_cursor;
dbms_sql.parse(cursor1, s1, dbms_sql.v7);
dbms_sql.close_cursor(cursor1);
end;
/
and replace your execute statements with: execddl('drop table ' || x); Received on Thu Mar 29 2001 - 17:08:42 CST
![]() |
![]() |