Re: how to disable EXCEPTIONS in PL/SQL ?

From: L. Carl Pedersen <l.carl.pedersen_at_dartmouth.edu>
Date: Tue, 11 Oct 1994 12:10:08 -0500
Message-ID: <l.carl.pedersen-1110941210080001_at_kip-1-sn-271.dartmouth.edu>


In article <37cos8$bp7_at_godot.cc.duq.edu>, SYJERRY_at_duq3.cc.duq.edu (Sy Jerry) wrote:

> I am writing several PL/SQL procedures and I can't seem to find a
> way to disable EXCEPTIONS. I find it annoying when I do a
> singleton select and if there are no records found, an exception
> occurs and aborts the procedure!! I'd like to use SQLCODE function
> to check for error status so I maintain control of the program.
>
> any ideas ?
>
> please email replies if possible
> thanks in advance
>
> jerry

you don't disable exceptions, you just handle them, e.g.:

begin
  select sm.abbrev into :summary.status_abbrev     from loan_loan l,

         loan_status_meaning sm
   where l.loan = :summary.loan and

         sm.status = l.status;
exception
  when no_data_found then null;
  when others then
    bug('Other exception in post-change2 for summary.loan.'); end;

in this case, i'm doing nothing at all on the no_data_found case, but i could assign a default value, give an error message, etc. etc. (Note: bug is my own procedure, and this is in the context of forms 3.0, but the general technique works everywhere.) Received on Tue Oct 11 1994 - 18:10:08 CET

Original text of this message