Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: IF Exists SQL statement help
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!
An inefficient TSQL thing that has no place in the Oracle world. In Oracle:
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE xyz';
EXCEPTION
WHEN OTHERS THEN
As Sybrand says ... study Oracle. If you try to do TSQL in Oracle you will create insecure, corrupt, poorly performing, unscalable, junk that someone else will get paid to rewrite.
Daniel Morgan Received on Fri Aug 23 2002 - 11:38:36 CDT
![]() |
![]() |