Re: PL/SQL question

From: Peter Falson <pfalson_at_mail.com>
Date: Thu, 29 Mar 2001 23:08:42 GMT
Message-ID: <Xns90745CF7C6B3Cpfalsonmailcom_at_203.164.20.181>


>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 Fri Mar 30 2001 - 01:08:42 CEST

Original text of this message