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: dropping a table, if it exists?

Re: dropping a table, if it exists?

From: Jadranko Lucic <jadranko.lucic_at_avl.com>
Date: Wed, 31 Jan 2001 14:35:18 +0100
Message-ID: <95941i$gt$1@fstgss02.tu-graz.ac.at>

U should not mix DDL inside of PL/SQL
try this:
BEGIN

      ECEXUTE IMMEDIATE 'drop table ADVSEARCH';
      ECEXUTE IMMEDIATE 'create table ADVSEARCH ( testfield number )';
 EXCEPTION
  WHEN OTHERS THEN
      ECEXUTE IMMEDIATE 'create table ADVSEARCH (testfield number)';  END;

dipl. ing. Jadranko Lucic
AVL Zagreb

"Hope" <hn67_at_mailcity.com> wrote in message news:3a75e748.5183815_at_news.newcastle.edu.au...
> hi-
>
> I am trying to test to see if a table exists, and then drop it. I
> would have thought that
>
> drop table advsearch
> where exists (select * from user_tables where
> table_name='ADVSEARCH';);
>
> would work, but it doesn't.
>
> I have also tried
>
> BEGIN
> drop table ADVSEARCH;
> create table ADVSEARCH ( testfield number );
> EXCEPTION
> create table ADVSEARCH (testfield number);
> END;
>
> to no avail. Please please help?
>
> gratefully,
>
> Hope
>
>
>
>
>
Received on Wed Jan 31 2001 - 07:35:18 CST

Original text of this message

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