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: sql script delete all tables

Re: sql script delete all tables

From: Joel Garry <joel-garry_at_home.com>
Date: 21 Mar 2003 17:37:57 -0800
Message-ID: <91884734.0303211737.573eac4c@posting.google.com>


"Alan" <alan_at_erols.com> wrote in message news:<b5fj46$28mlbn$1_at_ID-114862.news.dfncis.de>...

If you use set commands to turn off headings and stuff then spool it to a file name with a .sql extention, you wind up with a script you can execute with an @ command.

> I made a mistake in the code (I hate paying syntax), so perhaps that is the
> source of the confusion. This should do it:
>
> SELECT 'drop table '||tname||';' from tab;
>
> SQL> /
>
> 'DROPTABLE'||TNAME||';'
> ------------------------------------------
> drop table AGENTCLIENT;
> drop table AGENTDIVISION;
> drop table APPLICANT;
> drop table APPLICANT_AUDIT;
>
>
> Just log in as the schema owner and run the code as provided. The code will
> generate a DROP statement for each table as above. All you need to do then
> is copy and paste the whole block of statements.
>
>
>
>
> "teen" <s4012051_at_student.uq.edu.au> wrote in message
> news:b5dsrg$pt0$1_at_bunyip.cc.uq.edu.au...
> >
> > >OR,
> > >
> > >SELECT 'drop table '||tname||' from tab ; ' ;
> >
> > Am I meant to replace ||tname|| with the table name? Or is that some kind
> of
> > command?
> >
> > >
> > >Then copy and paste...
> >
> > Ahh yes, that will kind of defeat the purpose of making a script :/
> >
> > >
> >
> > I was thinking along the lines of something like
> > DROP TABLE * WHERE TABLE_NAME IN (SELECT TABLE_NAME FROM USER_TABLES);
> >
> > obviously i'm unsure if the syntax is correct.. i'm soon installing oracle
> on
> > this system so i'll be able to play around a bit.
> >
> > thanks for any hints I can get :P
> >
> >

jg

--
@home is bogus.
So is top-posting, but I did it here just to annoy people who complain
about it.
Received on Fri Mar 21 2003 - 19:37:57 CST

Original text of this message

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