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: IF Exists SQL statement help

Re: IF Exists SQL statement help

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Fri, 23 Aug 2002 14:12:16 +0200
Message-ID: <9d9cmugo4um8idpum49j1nn6jjco3cboc6@4ax.com>


On 23 Aug 2002 03:28:06 -0700, dennis.grisbeck_at_software-innovation.no (DG) wrote:

>In Microsoft sequal server I have this statement:
>
>if exists (select * from dbo.sysobjects where id =
>object_id('[my_table]') and OBJECTPROPERTY(id,'IsUserTable') = 1) DROP
>TABLE [my_table]
>GO
>
>this obviously checks to see if a table exists before executing the
>drop table statement.
>
>what would the Oracle equivalent of this be?
>
>Thanks from an Oracle newbie!

No need for that. Oracle has exception handling, so checking for the existence of a table instead of trapping it's non-existence should be considered a waste of resources.
The only need for it would occur when creating tables on-the-fly which is exactly what you should *NOT* do using Oracle. So, instead trying to port all your bad sql-server habits to Oracle (and porting sql-server code to Oracle *always* results in an awfully performing application) you should go for 'innovation', forget everything you learned about databases, and try to learn Oracle.

Regards

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Fri Aug 23 2002 - 07:12:16 CDT

Original text of this message

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