Re: How to know if a sqldba command failed ?

From: Burton V. Peltier <ep94bvps_at_noh71cd.shell.com>
Date: 1995/07/12
Message-ID: <DBM4FK.J9B_at_shellgate.shell.com>#1/1


In article <lfeges.31.2FFD8005_at_hookup.net>, lfeges_at_hookup.net (Louis Feges) writes:
>> In article <3tbvp4$ek8_at_ccpnws.in2p3.fr> chaleat_at_cc.in2p3.fr (Philippe Chaleat) writes:
>> >From: chaleat_at_cc.in2p3.fr (Philippe Chaleat)
>> >Subject: How to know if a sqldba command failed ?
>> >Date: 4 Jul 1995 18:03:16 GMT
 

>> >Hello,
>>
>>
>> >How could now if a sqldba command failed. For instance, in csh:
 

>> > sqldba lmode=y << EOF
>> > connect toto/toto
>> > EOF
>> > SQL*DBA: Release 7.1.4.1.0 - Production on Tue Jul 4 19:58:53 1995
 

>> > Copyright (c) Oracle Corporation 1979, 1994. All rights reserved.
 

>> > Oracle7 Server Release 7.1.4.1.0 - Production Release
>> > PL/SQL Release 2.1.4.0.0 - Production
 

>> > SQLDBA> ORA-01034: ORACLE not available
>> > ORA-07429: smsgsg: shmget() failed to get segment.
>> > IBM AIX RISC System/6000 Error: 2: No such file or directory
>> > SQLDBA>
>> > SQL*DBA complete.
 

>> > echo $status
>> > 0
 

>> >I was expected something different (1 for example...)
>>
>>
>> > Thanks for any advice...
>>
>> Only way that i know is to grep the output file for 'ORA-' and assume the
>> worst if found. None of the Oracle execs, SQLPLUS/SQLLOAD/..etc. can be relied
>> upon to return a non-zero return-code when failing.
>>
>> \louis

Using sqlplus, put the following line in your command file and the return code will come back either as 0 or 1 ...

whenever sqlerror exit failure sql.sqlcode

-- 
*****************************************************
* Burt Peltier Shell Offshore    ep94bvps_at_shell.com *
* (504) 588-0179 701 Poydras #1660 New Orleans 70139*
*****************************************************
Received on Wed Jul 12 1995 - 00:00:00 CEST

Original text of this message