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: Trapping Errors in SQL*Plus

Re: Trapping Errors in SQL*Plus

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Mon, 8 Nov 1999 15:34:10 +0100
Message-ID: <806n4t$9ui$1@oceanite.cybercable.fr>


I know you don't want to use PL/SQL, but if you want to trap the reason of the failure you can enclose each statement in an anonymous PL/SQL block:

whenever sqlerror exit [rollback|commit];

begin

   <your first statement>
exception

   when others then

     <what you want, for instance dbms_output.put_line(sqlerrm);>
     raise;

end;
/
...
and then for the others statements.

--
Regards
Michel

Mark Sims <mark.k.sims_at_bt.com> a écrit dans le message : 3826D792.E0A794CF_at_bt.com...
> Many thanks for the suggestion. Whilst this works in the sense of stopping
> the process it doesn't allow us to trap the reason for the failure (and hence
> stop gracefully).
>
> Regards,
>
> Mark Sims
>
> Michel Cadot wrote:
>
> > Even in SQL*Plus you can use the statement
> > whenever sqlerror exit [commit|rollback];
> >
> > This makes the script exit SQL*Plus when an error occurs.
> >
> >
> >
>
Received on Mon Nov 08 1999 - 08:34:10 CST

Original text of this message

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