Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Conditionally quitting Sqlplus
On Apr 16, 8:44 am, "Transalp" <nick_william..._at_mentor.com> wrote:
> Hi all,
>
> Is is possible to do this in 9i and 10g?
>
> I have an upgrade script that does some pre-upgrade checking before
> applying schema changes, and I want it to quit before applying the
> schema changes if it finds certain problems in the data. I'm just
> looking for something like an IF-THEN-QUIT that would work in the
> context of an anonymous PL/SQL block.
>
> TIA
> Transalp
In pl/sql code use raise_application_error (see PL/SQL Users Guide and Reference) to terminate the pl/sql code and return to SQLPlus.
In SQLPlus use the WHENEVER clause to exit on error:whenever sqlerror exit FAILURE. See the SQLPlus manual.
HTH -- Mark D Powell -- Received on Mon Apr 16 2007 - 09:00:22 CDT