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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Can a Stored Proc DROP a table?

Re: Can a Stored Proc DROP a table?

From: Jonathan Gennick <jonathan_at_gennick.com>
Date: 2000/06/09
Message-ID: <i2u0kskrqbekrmf5grnlb91nrd7rrmjil7@4ax.com>#1/1

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



jonathan_at_gennick.com
http://gennick.com
Brighten the Corner Where You Are

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

Original text of this message

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