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

Home -> Community -> Usenet -> c.d.o.misc -> Re: user defined exception.

Re: user defined exception.

From: Daniel A. Morgan <damorgan_at_exesolutions.com>
Date: Tue, 22 Jan 2002 12:44:12 +0000
Message-ID: <3C4D5E9C.17D42A7E@exesolutions.com>


This is remarkably easy:

CREATE OR REPLACE PROCEDURE xyz IS

   x PLS_INTEGER;
   rtfm EXCEPTION;

BEGIN
   SELECT COUNT(1)
   INTO x
   FROM dual;

   IF x > 1 THEN

      RAISE rtfm;
   END IF; EXCEPTION
   WHEN rtfm THEN

      DBMS_OUPUT.PUT_LINE('Another User Did Not RTFM');    WHEN OTHER THEN
      DBMS_OUPUT.PUT_LINE('Something Else Happened');

END;
/

Daniel Morgan

Hugues Landry wrote:

> Hi Everyone,
> Does anyone know how i can register an exception into the system so
> that when it throws it display a message specified by me !!
>
> Here's some code
>
> CREATE OR REPLACE PROCEDURE throwMyException
> IS
> myException EXCEPTION;
> BEGIN
> RAISE myException;
> END;
>
> When called this method produce this output :
>
> ORA-06510: PL/SQL: unhandled user-defined exception
> ORA-06512: at "TESTDB.THROWMYEXECPTION", line 5
>
> I know i can use the pragma exception_init to associate my exception
> to an already existing one, but is there a way to define this myself
> ??
>
> Hugues Landry
Received on Tue Jan 22 2002 - 06:44:12 CST

Original text of this message

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