Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: help with exceptions please
On Sep 25, 11:31 am, DA Morgan <damor..._at_psoug.org> wrote:
> > 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.
Thanks Mr. Morgan, Frank, Mark for the explanations
It's all a lot more clear to me how things work now. One thing though, I could not understand how Oracle could possibly automatically assign a negative number to an exception like:
my_exception EXCEPTION;
Without possibly replacing an existing exceptions number. So, I copied some code and changed it up a bit:
CREATE OR REPLACE PROCEDURE trap_errcode IS
my_error EXCEPTION;
ecode NUMBER(38);
thisproc CONSTANT VARCHAR2(50) := 'trap_errmesg';
BEGIN
NULL;
RAISE my_error;
EXCEPTION
WHEN OTHERS THEN
ecode := SQLCODE;
dbms_output.put_line(thisproc || ' - errcode: ' || ecode || ' msg
- ' || SQLERRM);
END trap_errcode;
Turns out the "User-Defined Exceptions" have an error code of 1 (until you do EXCEPTION_INIT).
But, thanks for the explanations, it makes much more sense to me now. Received on Tue Sep 25 2007 - 16:51:38 CDT