Re: How to find out if a table already exists with PL/SQL

From: Mitsunori Ishikawa <ishikawa_at_metrosystems.co.jp>
Date: Fri, 10 Nov 2000 17:56:20 +0900
Message-ID: <3A0BB834.FE6E2C30_at_metrosystems.co.jp>


Hi TIA,

If you are going to use SQL*Plus with script file, make script file like following dorptmp.sql and execute this script file like this:

SQL>_at_droptmp

Mitsunori Ishikawa

  • droptmp.sql ----- set newpage 0 set space 0 set linesize 80 set pagesize 0 set echo off set feedback off set heading off set termout off

spool dropping.sql
select 'PROMPT Dropping table '||table_name||'.....'||CHR(10)||'DROP TABLE '||table_name||';'   from user_tables where table_name = 'TEMPTBL'; spool off
set feedback on
set termout on
_at_dropping

  • droptmp.sql -----

NoSpam wrote:
>
> Hi,
>
> I'm porting a Sybase script to Oracle. There is this thing that we do in
> Sybase but I just can't do in Oracle. In Sybase, we do:
>
> if exists (select * from sysobjects where name = 'TEMPTBL')
> begin
> print "Deleting table TEMPTBL....."
> drop table TEMPTBL
> end
> go
>
> Just how do I do this in Oracle?
>
> TIA
Received on Fri Nov 10 2000 - 09:56:20 CET

Original text of this message