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: SQL*PLUS and shell scripts

Re: SQL*PLUS and shell scripts

From: Rob Spies <rspies_at_minn.net>
Date: 1997/03/14
Message-ID: <5gad9p$a6$1@cobra.minn.net>#1/1

Prashant Gaba <pgaba_at_usccmail.bms.com> wrote:

>Hi All,
 

>I am trying to productionise some of the queries that we run.
>My question is:
> How can I return the sql error code to a Unix shell script?
>I tried putting "WHENEVER SQLERROR EXIT SQLCODE" and although sqlplus
>exits with an error it does not return the correct code to the shell
>script which always displays 1.
 

>I also tried hardcoding 942 in place of sqlcode and when i displayed the
>error code in the shell script it displays 174.
>I know this is possible as I have done this DCL on VMS but I am missing
>something here.
>Can some one help????
 

>Thanks
>--
>Prashant Gaba
>Consultant
>e-mail: pgaba_at_usccmail.bms.com

Hi...

I don't know if this will help much, but it might get you going in the right direction...

First, the UNIX error code has range of 0-255. So, if you calculate the modulus 256 of 942, you get 174. When you hardcoded 942 as your exit code, UNIX converted 942 to 174. So that seems to be working OK... but probably not what you were looking for.

I have also tried passing sql error codes back to the shell script, but to no avail. I'd be interested in finding out a way to do this, too...

Rob
rspies_at_minn.net Received on Fri Mar 14 1997 - 00:00:00 CST

Original text of this message

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