Re: HELP : getting execution status from sqlplus to Unix scripts

From: N Prabhakar <prabhs_at_po.pacific.net.sg>
Date: 1996/11/22
Message-ID: <5743l4$lb2_at_newton.pacific.net.sg>#1/1


>>>Hi there,
>>>
>>>I have got a Unix shell script running several PL/SQL scripts (via
 sqlplus)
>>>sequentially. I would like to exit this shell if any of the PL/SQL
 scripts
>>>fails and return an error code to the scheduller which runs this shell.
>>>Is there an easy way to get the execution status from sqlplus ?
>>>
>>>Here is the type of shell script I use :
>>>
>>>#!/bin/ksh
>>>...
>>>sqlplus user1/user1 _at_load_person.sql > $LOGFILE
>>>...
>>>sqlplus user1/user1 _at_load_address.sql > $LOGFILE
>>>...
>>>
>>>
>>>Any suggestion is welcome. Thanks.
>>>
>>>Sergio
>>>--
>>>Sergio Gracia GraciaS_at_Logica.com

>Miles Thomas

Hi there,

We encountered the problem and tried using WHENEVER SQL_ERROR EXIT SQL.SQLCODE. For example, if Oracle aborts with error ORA-1400 (Mandatory column missing or Null during insert), SQL*plus exits with 1400 error, but the Operating system changes 1400 error into its own error and gives something like 40 (just as a example)

Immediately after exiting sql*plus after error, if you type

echo $?

it will return 40, instead of 1400. What we were told is that Operating system overrides the SQL*Plus error.

If there is a workaround, please let me know as it will simplify error handling in my project.

Regards

N.Prabhakar Received on Fri Nov 22 1996 - 00:00:00 CET

Original text of this message