Re: Returning from Exception Handler

From: Scott Urman <surman_at_dlsun338.us.oracle.com>
Date: 1996/08/12
Message-ID: <4unobt$9u3_at_inet-nntp-gw-1.us.oracle.com>#1/1


In article <kolbjorn.aambo-1208961514310001_at_ubmac86.uio.no>, kolbjorn.aambo_at_ub.uio.no (Kolbjørn Aambø) writes:
|> In article <00001a1b+00007d0d_at_msn.com>, richu_at_msn.com (Richard Hu) wrote:
|>
|> > What you need to do is put the looped DML statement in its own
|> > sub-block..therefore, when it causes an exception, you can
|> > handle it within that sub-block and still yet be able to
|> > continue on with the loop after the exception passes out of the
|> > sub-block..
|> >
|>
|> Have read several discussions on the net stating that exceptions are meant
|> for last resort right before termination error handling. Given that
|> Exceptions don't seem like the most appropiate thing to continue from
|> inside the same routine. I may be wrong though. My problem with Oracle 7.0
|> is that Exceptions don't seem to be awailable ..... When was Exceptions in
|> Pl/SQL actually implemented? ORACLE 7.1 ? I use PL/SQL 2.0xx.

PL/SQL is based on Ada - there are a number of similarities between the two languages. Exceptions are one of them. They have been around since PL/SQL has been around - version 1 with Oracle 6. I don't agree that exceptions are meant for last resort. Any Oracle error is raised as an exception, and these are not always fatal (no data found, for example). You can continue from an exception inside a routine by putting the statement and its handler inside a subblock:

BEGIN
 ...
 BEGIN
   statement_which_could_raise_an_exception;  EXCEPTION
   WHEN OTHERS THEN
     handle_it;
 END;
END;



Scott Urman Oracle Corporation surman_at_us.oracle.com

Author of _Oracle PL/SQL Programming_ ISBN 0-07-882176-2 Published by Oracle Press - http://www.osborne.com/oracle/index.htm

"The opinions expressed here are my own, and are not necessarily that of  Oracle Corporation"
Received on Mon Aug 12 1996 - 00:00:00 CEST

Original text of this message