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

Home -> Community -> Usenet -> c.d.o.misc -> Re: How can i drop a table in a PL/SQL Block

Re: How can i drop a table in a PL/SQL Block

From: <sunrise828_at_my-deja.com>
Date: Mon, 22 Nov 1999 20:09:49 GMT
Message-ID: <81c7u9$fsm$1@nnrp1.deja.com>

> ...
> select count(*) into aux from user_tables
> where table_name = 'XXX';
> if SQL%FOUND then
> DROP TABLE XXX;
> end if;
> end;
>
> How can i do this.

This code can execute any special SQL

v_sql := 'DROP TABLE XXX';
special_sql(v_sql);

PROCEDURE special_sql (p_sql VARCHAR2)
as

   ch INTEGER;
begin

   ch := DBMS_SQL.OPEN_CURSOR;
   DBMS_SQL.PARSE(ch,p_sql,DBMS_SQL.NATIVE);    DBMS_SQL.CLOSE_CURSOR(ch);
   commit work;
end special_sql;

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Mon Nov 22 1999 - 14:09:49 CST

Original text of this message

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