Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Ignore ORA 942 Error

Re: Ignore ORA 942 Error

From: Hans Forbrich <news.hans_at_telus.net>
Date: Tue, 12 Oct 2004 15:08:49 GMT
Message-ID: <5sSad.35550$663.6687@edtnps84>


Louis Frolio wrote:

> nmdavies1104_at_hotmail.com (Neil) wrote in message
> news:<caef6318.0410120207.4ae42d2a_at_posting.google.com>...

>> I have a unix script that includes a DROP TABLE and CREATE TABLE
>> command in SQL Plus.it works fine if the table to drop is there.  If
>> not the script ends.  Can anyone advise how I can ignore the
>> "ORA-00942: table or view does not exist" error and continue to the
>> next command?

>
> Why not put in a little code to check for the existence of this
> object, if it exists you gracefully move on to the next part of your
> code, if it does not you create it?
>
> L

You mean run something like

SPOOL DROPEM.SQL
SELECT 'DROP TABLE '|| table_name || ' CASCADE;'   FROM USER_TABLES
 WHERE TABLE_NAME IN ('A', 'B', 'C')
/
SPOOL OFF
@DROPEM at the beginning of the unix script? (with appropriate SQLPLus settings and column formatting as described in the manual) and then running all the creates <g>

/Hans Received on Tue Oct 12 2004 - 10:08:49 CDT

Original text of this message

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