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: Kannan Rajesh <krajesh_at_hpsgnal.sgp.hp.com>
Date: 1997/03/14
Message-ID: <3328C377.4A26@hpsgnal.sgp.hp.com>#1/1

Prashant Gaba 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,

  If this is the scenario, then spool the output of the sql statements you run to an temporary file and use the grep command for ERROR or ORAin  that temporary file and display the appropriate error.

Thanks & Regards

K.Rajesh
Oracle DBA Received on Fri Mar 14 1997 - 00:00:00 CST

Original text of this message

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