Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Usenet -> c.d.o.server -> Re: help with exceptions please

Re: help with exceptions please

From: DA Morgan <>
Date: Tue, 25 Sep 2007 08:31:36 -0700
Message-ID: <> wrote:
> On Sep 23, 6:54 pm, DA Morgan <> wrote:

>> wrote:
>>> RAISE_APPLICATION_ERROR(error_number, error_message [, keep_errors])
>>> since they have no name, there is no way one could catch them using:
>>>           WHEN error_name THEN
>>> so there's nothing you can do about them.
>> The intent of RAISE_APPLICATION_ERROR is not to trap them it is to
>> RAISE them as in send them to the front-end application. This syntax
>> is most commonly found in an exception block.

> OK. So for exceptions such as
> my_exception EXCEPTION;
> the point can be to catch and handle, however the other types of
> errors with negative numbers including the ORA- and ones raised with
> RAISE_APPLICATION_ERRORS type errors, the point is to give them to the
> front end application (even though you can associate exceptions with
> negative numbers if you wish to). Let me know if i have it wrong.

That's how I would use it. Trap the exception, log it in the exception block, and then raise an application specific exception, to communicate with the end user.

>>> (by the way, why would one want to keep_errors or not keep_errors
>>> here?)

> My question is, what's the point of keeping_errors vs. not
> keeping_errors when raising an application error? I understand you can
> have a stack of errors that are propogated, but why throw away the
> stack vs. not throw it away?

Throw it away and you may lose the originating cause. End users, however, do not take kindly to cryptic error stacks. So you process the stack, store it in a log file for future research, and then raise a user friendly exception for the application.

> But now I do have a question. If the point of the negative number
> type errors is not to trap them, then what would be the point of
> associating them with an identifier/name using EXCEPTION_INIT?

The point of the number is to make analysis simple whether it is a question of looking it up in a manual or analyzing the exceptions generated by an application in order to fix the most common ones.

> also, as for the terminology are the ones with negative numbers called
> exceptions too? Or application errors? Just trying to understand> here.

All exceptions have negative numbers.

Daniel A. Morgan
University of Washington (replace x with u to respond)
Puget Sound Oracle Users Group
Received on Tue Sep 25 2007 - 10:31:36 CDT

Original text of this message