Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL question

Re: PL/SQL question

From: Peter Falson <pfalson_at_mail.com>
Date: Thu, 29 Mar 2001 23:08:42 GMT
Message-ID: <Xns90745CF7C6B3Cpfalsonmailcom@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 Thu Mar 29 2001 - 17:08:42 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US