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

Home -> Community -> Usenet -> c.d.o.server -> Re: Abort script in SQLPLUS

Re: Abort script in SQLPLUS

From: Keith <keithhoxie_at_verizon.net>
Date: 14 Oct 2006 16:49:24 -0700
Message-ID: <1160869763.990279.271670@m7g2000cwm.googlegroups.com>

klabu wrote:
> 10gR2
>
> How to quit a script in SQL*PLUS ?
>
> I have this line:
>
> ACCEPT v_inp PROMPT 'Quit (Q) or Run(R) ?'
>
> I want the script-running aborted if v_input is Q
>
> thanks

One way is to use sql*plus "whenever sqlerror exit" and pl/sql raise_application_error such as:

whenever sqlerror exit

begin

   if &v_input. = 'Q' then raise_application_error( -20000, 'Quit'); endif;
end;
/

whenever sqlerror continue Received on Sat Oct 14 2006 - 18:49:24 CDT

Original text of this message

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