Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Can a Stored Proc DROP a table?
It can be done, but it's not as easy as you probably would like. You need to read up on the built-in PL/SQL package named DBMS_SQL. You have to use dynamic SQL to execute DDL from within PL/SQL.
Jonathan
On Thu, 08 Jun 2000 20:08:43 GMT, Sean <dolans_at_my-deja.com> wrote:
>I would like to create a stored procedure that when called, drops a
>table and then recreates it. Can a stored procedure accomplish this?
>I have tried the statment DROP table tbl_test; in my PL/SQL code, but
>it gives me an error.
>
>Any ideas?
>
>Thanks,
>Sean
>
>CODE:
>------------
>CREATE OR REPLACE PROCEDURE SP_TEST
>(intSuccess OUT NUMBER)
>IS
>BEGIN
> drop table test;
> intSuccess := 1;
>END;
>/
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Received on Fri Jun 09 2000 - 00:00:00 CDT