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: SQL Plus: procedural problem

Re: SQL Plus: procedural problem

From: <Solomon.Yakobson_at_entex.com>
Date: 1997/02/24
Message-ID: <856793512.27864@dejanews.com>#1/1

All you need is:

  WHENEVER SQLERROR EXIT
  DECLARE
  BEGIN
    some pl/sql processing
  EXCEPTION
    insert of error codes into an error table     RAISE;
  END; Simply reraise the error in EXCEPTION part of your BEGIN block. Error will be propogated back to SQL*Plus. WHENEVER SQLERROR EXIT will force SQL*Plus to exit. Take a look at WHENEVER SQLERROR options (exit status, ROLLBACK, COMMIT) to choose the option you need.

Solomon.Yakobson_at_entex.com
In article <330E164B.3CDC_at_umich.edu>,
  esteinma_at_umich.edu wrote:
>
> I am in search of the proper product to handle a problem:
>
> A sql script that is something like:
>
> DECLARE
> BEGIN
> some pl/sql processing
> EXCEPTION
> insert of error codes into an error table
> END;
> ....
> more pl/sql processing
> ....
> @purgrpts -- calling another sql script
> ....
> exit
>
> What I want to do is to look at the error table after the first pl/sql
> block finishes. If there are any errors logged I want the sql script to
> exit. So just after the "END;" statement there would be code something
> like:
>
> select count(*) into errs from err where error_num = 12;
> if errs>0 then
> exit;
> end if;
>
> Of course, "exit" doesn't work this way in pl/sql. And there is no way
> to pass values from pl/sql to sql*plus. My question: what is the best
> product to handle something like this: oraperl, Pro*C, SQR (a reporting
> tool but it has a lot of other capabilities) or something else?
>
> --
> ===========================================================================
> Ed Steinman What the Zen Buddhist said to the
> Computing Unit, School of Dentistry hot dog vendor:
> University of Michigan
> Ann Arbor, MI 48109-1078 "Make me one with everything."
> voice: 313-764-9850
> FAX: 313-647-4024
> e-mail: esteinma_at_umich.edu

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
Received on Mon Feb 24 1997 - 00:00:00 CST

Original text of this message

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