Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: EXCEPTION or Return code?
Ubiquitous wrote:
>How do you all prefer to handle exception handling? I was looking at
>some examples and noticed a lot of them seem to use return code type
>parameters which return a zero is it executed without any trouble
>and some other value(s) if an exception occurred. This struck me as
>silly because the internal exception handling seems to perform that
>function already. Am I missing something or is this a case of "old
>habits die hard"?
>
>
One codes exception handling based on the design of the application.
Exception handling at the application level is often best handled by
passing back a return value.
How else for a procedure that calls another to know the outcome of what
was done on its behalf.
But within a single procedure or function exception handling can be done
in many ways. I usually
use a stored procedure with PRAGMA AUTONOMOUS_TRANSACTION to perform
inserts
into a logging table, multiple nested blocks to trap Oracle and
application issues using PRAGMA
EXCEPTION_INIT, user defined exceptions, named exceptions, RAISE, and
RAISE_APPLICATION_ERROR. Each situation demands an approach that makes
sense based
on the design. There are not hard and fast rules.
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Wed Oct 08 2003 - 10:24:07 CDT
![]() |
![]() |