Re: Interactive Scripts, return codes

From: Karen Lindsey <ksl_at_usa.net>
Date: 1997/06/06
Message-ID: <9706062205.AA001ha_at_ksl.uk>#1/1


"Martyn Cavett" <cavett_at_anonymous.com> wrote:
> As far as returning error codes from ORACLE go - include at the beginning
> of your SQL script files a line such as
 

> ON SQLERROR THEN EXIT ROLLBACK;
 
> This will immediatelly abort the script and rollback work before exiting if
> there are any SQL errors raised (un-handled exceptions).

Right - this is essentially the only reference to error handling that I could find *anywhere* in the Oracle manuals. There is also OS error handling.

[snip]
> The return code is raised by ORACLE and handled in a shell script.

Sure, but if I passed complete crap to sqlplus no error code is returned - it only works if valid SQL is passed but the server has problems.

Of course, you could grep for the error messages that you know about, but that is pretty poor, too.

The only definitive way I have managed to get a decent return code has been to use a C program that gives a cursor interface, since the Oracle compiler environment *does* provide decent error handling, AFAIK.

If anyone else has a better way of putting error handling in scripts, I would appreciate a response on this also.

  • KSL. -
Received on Fri Jun 06 1997 - 00:00:00 CEST

Original text of this message