Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

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

Re: help with exceptions please

From: <jgarfield_at_earthlink.net>
Date: Tue, 25 Sep 2007 14:51:38 -0700
Message-ID: <1190757098.106621.156690@o80g2000hse.googlegroups.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US