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: drop table script

Re: drop table script

From: LJF <lfranklin_at_my-deja.com>
Date: Fri, 19 Nov 1999 20:18:31 GMT
Message-ID: <814baj$71f$1@nnrp1.deja.com>


Create a SQL*Plus script (or just type the commands in SQL*Plus) that creates another script to drop the objects:

set pagesize 0 feedback off
spool drop_obj.sql
select 'drop '||object_type||' '||object_name||';' from user_objects; spool off

This creates the script drop_obj.sql which you can edit, if desired, before you run it.

Larry

In article <81491m$57j$1_at_nnrp1.deja.com>,   sonali2000_at_my-deja.com wrote:
> I am trying to write a drop table, view .. script, which will find all
> my user objects and drops them. But apparently PL/SQL does not support
> drops or creates, which is really weird. Following is the script that
I
> have written. Can someone suggest some modifications or a way to
achieve
> my goal? I have even tried putting the drop statement within single
> quotes and also within double quotes.
> Thanks in advance.
>
> P.S. - PLEASE MAKE SURE YOU HAVE A DUMMY USER/ DATABASE BEFORE USING
> THIS SCRIPT. IF IT DOES WORK, IT WILL DROP ALL THE OBJECTS IN YOUR
USER
> ACCOUNT.
>
> --Sonali.
>
> SCRIPT:
>
> DECLARE
> CURSOR cur_obj IS
> SELECT object_name, object_type FROM user_objects;
> BEGIN
> FOR cur_rec IN cur_obj LOOP
> drop cur_rec.object_type cur_rec.object_name;
> END LOOP;
> COMMIT;
> END;
> /
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Fri Nov 19 1999 - 14:18:31 CST

Original text of this message

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