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

Home -> Community -> Usenet -> c.d.o.tools -> Re: How to return an value from Oracle to Unix in a shell scrtip.

Re: How to return an value from Oracle to Unix in a shell scrtip.

From: <sybrandb_at_my-deja.com>
Date: Mon, 23 Oct 2000 11:48:42 GMT
Message-ID: <8t18ip$p5v$1@nnrp1.deja.com>

In article <8t15o4$n45$1_at_nnrp1.deja.com>,   edwardmi1_at_my-deja.com wrote:
> In article <8t0v00$ilf$1_at_nnrp1.deja.com>,
> sybrandb_at_my-deja.com wrote:
> > In article <39EDF96B.3A805BF1_at_email.com>,
> > gojo <kckcabc_at_email.com> wrote:
> > > Hi there,
> > >
> > > I've a shell script that runs some Oracle procedures, what I would
 like
> > > to know is if the Oralce procedure was successful or had any
 error.
> > > Basically a flag that tells me everything is OKed, so I can do
 something
> > > else in the subsequent shell codes.
> > >
> > > Does anyone what are the methods to achieve that ?
> > >
> > > Thanks,
> > > Ken.
> > >
> > >
> > include
> > whenever sqlerror exit return_value|variable_name|:bind_variable
> > in your sqlplus script and the value you use will be passed as
 return
> > code, and of course you can query that by $?
> >
> > Hth,
> > --
> > Sybrand Bakker, Oracle DBA

>

> I've understood Ken's question in the following way:
> How can we return to the Unix shell script the result of
> the termination of the sqlplus script that has been called
> from this shell script (like batch mode)?
> A bind variable let us get the result of the termination
> of an Oracle procedure in the SQL*Plus session/script,
> but not outside it - I mean - not in the shell script.
> A bind variable of SQL*Plus is not same as a variable of
> the Unix shell script.
>

> Really, I've never been faced with such sort of problem
> before - may be - try to spool result of sqlscript and
> then read this file in the shell, or parse the stdout
> of the sqlplus command.
>

> Edward,
> Oracle Developer,
> edwardmi_at_iname.com
>

> Sent via Deja.com http://www.deja.com/
> Before you buy.

>

Contrary to what you say, the variable in the exit clause will end up in the rc variable, thus *outside* sqlplus. I am quite positive about this and just to be sure I have checked this. Also by running sqlplus in silent mode you can make sure your standard output ends up in a variable by using variable=`sqlplus .... @script`
As this is Unix this is quite obvious.
You please don't spread information which is obviously incorrect, sorry to say so.

Regards,

--
Sybrand Bakker, Oracle DBA

All standard disclaimers apply
------------------------------------------------------------------------


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Mon Oct 23 2000 - 06:48:42 CDT

Original text of this message

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