Re: Grrr! How do you make sqlplus exit on a syntax error!

From: Richard Kuhler <noone_at_nowhere.com>
Date: Tue, 08 Oct 2002 22:08:46 GMT
Message-ID: <OHIo9.60552$X9.11034230_at_twister.socal.rr.com>


I agree, there should be a command like 'WHENEVER SQLPLUSERROR' but there isn't. They know that it works this way ... "WHENEVER SQLERROR ... SQL*Plus will not exit on a SQL*Plus error."

[Quoted] FYI, I typically use this logon sequence as the top of batch scripts ...

scott/tiger_at_orcl
--/--
--/--

If the login is successful then those are treated as comments otherwise they fail as login attempts and the script exits. Just seems a little clearer to me but decide for yourself.

Richard

Peter Lacey wrote:
>
> I want to call various sql scripts from within a perl script and know
> if they succeeded or failed. After a series of setbacks I have the
> following code preceeding the SQL itself:
>
> WHENEVER OSERROR EXIT 255
> WHENEVER SQLERROR EXIT 255
> CONNECT &1/&2_at_&3
> BEGIN
> NULL;
> END;
> /
> WHENEVER SQLERROR EXIT SQL.SQLCODE
>
> The 6 silly lines in the middle were needed simply to get sqlplus to
> exit on a failed login. However, if the SQL that follows contains a
> -syntax- error, nothing happens, sqlplus just keeps running the SQL.
> So the question is, where is the Oracle equivalent of WHENEVER
> SYNTAXERROR EXIT (whatever). Be aware that there are tens of files
> each thousands of lines long. A good answer would allow me to modify
> each file in just one place.
>
> <rant>Who wrote this thing, anyway? Hasn't sqlplus been around for
> 100 years? Hasn't anyone ever needed to simply exit sqlplus when
> something -anything- goes wrong?</rant>
Received on Wed Oct 09 2002 - 00:08:46 CEST

Original text of this message