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: How to drop an nonexist table without the error message?

Re: How to drop an nonexist table without the error message?

From: <emaus081269_at_my-deja.com>
Date: 2000/05/09
Message-ID: <8f9apa$9tj$1@nnrp1.deja.com>#1/1

if you are really looking for an if then else way to handle it, look at all_tables where owner = x and table_name = y. If in your own schema try user_tables where table_name = x

In article <8f74e1$qnt$1_at_web1.cup.hp.com>,   "Maggie" <maggiezhou_at_hotmail.com> wrote:
> When I write create table script, I always put "drop" first, such as,
> drop table orders;
> create table orders(id number);
>
> I have some tables and indexes need to drop and recreate everyday.
> However, if this is the first time to run the drop and create table,
 it
> always shows the error that "table or view does not exist" first, and
 then
> create the table.
> How to drop an nonexist table without the error message?
>
> It really bother me because some scheduling tool will take as the
 error and
> stop the whole process. Hence, I would like to add some sort of "IF
 THEN"
> statement that bypass the "DROP" if the table has not created yet. I
 know
> the MS SQL Server, we run the statement as the following to avoid this
> error:
> if exists (select * from sysobjects where id = object_id(N'[dbo].
 [Orders]')
> and OBJECTPROPERTY(id, N'IsUserTable') = 1)
> drop table [dbo].[Orders]
> GO
>
> Would you please tell me how it works in the ORACEL. Hope Oracle got
 this
> piece of beauty as well as MS SQL Server. Please help.
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue May 09 2000 - 00:00:00 CDT

Original text of this message

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