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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Can EXIT cause SQLPlus to have a different return value?

Re: Can EXIT cause SQLPlus to have a different return value?

From: <mpir_at_compuserve.com>
Date: Fri, 11 Jun 1999 20:48:09 GMT
Message-ID: <7jrsm6$pk5$1@nnrp1.deja.com>


There are two answers to the thread.

1- You can use 'Exit %SQLCODE' to terminate the script. The EXIT statement takes a value/variable as an optional parameter. There is an environmental parameter in SQL*PLUS which contains the return code from the last SQL statement. I don't have a reference here to look it up (I would be surprised if I remembered %SQLCODE correctly).

2-If your OS is equipped to handle DLL's, then an external program can be called from SQL*PLUS/Oracle. THere is a white paper on Metallink on how to do it. Also, pipes and UTL_FILE output could be used, depending on your scripting language.

In article <37613E58.3E36FD6E_at_tivoli.com>,   John Warner <john.warner_at_tivoli.com> wrote:
> Thanks for the pointer. I'm still learning SQL and hadn't made it
that far
> yet. Is it possible to call an external program using the EXCEPTION
> statement?
>
> TIA,
>
> John
>
> Brian Peasland wrote:
>
> > >I have a situation where I need to monitor the results of a SQL
> > >statement executed by SQLPlus (possibly isql) to determine what
action
> > >to take in some third party software. However, regardless of what
the
> > >SQL statement does, SQLPlus always returns a 0 because it (SQLPlus)
> > >correctly terminated. How can I cause SQLPlus to return something
other
> > >than zero based on the results of the SQL statement? I've looked
at the
> > >EXIT statement but that doesn't appear to do what I need.
> >
> > Have you tried to create a PL/SQL statement. That way, you can use
the
> > EXCEPTIONS portion of PL/SQL. If an error occurs, you can raise an
> > exception. Properly done, you can create your own error codes and
your
> > application program can read those error codes to determine
appropriate
> > action.
> >
> > Hope that helps,
> > Brian Peasland
> > peasland_at_msn.com
>
>

--
Joseph R.P. Maloney, CCP,CSP,CDP
MPiR, Inc.
502-451-7404
some witty phrase goes here, I think.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Fri Jun 11 1999 - 15:48:09 CDT

Original text of this message

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