Re: Valid Error numbers

From: Jean-Luc <jeanluc_at_zap.a2000.nl>
Date: Wed, 1 Sep 1999 11:53:34 GMT
Message-ID: <FHDqDH.ICL_at_ahisinfr.xs4all.nl>


The range you may use is 20000-20999. The Oracle 7.3 pl/sql 2.3-documentation says this:

To call raise_application_error, you use the syntax

raise_application_error(error_number, message[, {TRUE | FALSE}]); where error_number is a negative integer in the range -20000 .. -20999 and message is a character string up to 2048 bytes long. If the optional third parameter is TRUE, the error is placed on the stack of previous errors. If the parameter is FALSE (the default), the error replaces all previous errors. Package DBMS_STANDARD is an extension of package STANDARD, so you need not qualify references to it.
An application can call raise_application_error only from an executing stored subprogram. When called, raise_application_error ends the subprogram and returns a user-defined error number and message to the application. The error number and message can be trapped like any Oracle error. In the following example, you call raise_application_error if an employee's salary is missing:

CREATE PROCEDURE raise_salary (emp_id NUMBER, increase NUMBER) AS

   current_salary NUMBER;
BEGIN
   SELECT sal INTO current_salary FROM emp

      WHERE empno = emp_id;
   IF current_salary IS NULL THEN

      /* Issue user-defined error message. */
      raise_application_error(-20101, 'Salary is missing');
   ELSE
      UPDATE emp SET sal = current_salary + increase
         WHERE empno = emp_id;

   END IF;
END raise_salary;

Good luck! Jean-Luc

Santosh Kharolkar wrote in message <37CC06BF.16518589_at_cheerful.com>...
>Hello there, my most resourceful friends
>
>Some time back I read some info about the error number
>
>distribution, and the reserved error numbers. i do not remember
>
>the details..
>
>Now in my forms application we need to define some error numbers
>
>and messages those are application specific. Which numbers are
>
>safe to use.
> [Quoted]
>Any Help, pointers to information is welcome...
>
>Thanking you in anticipation
>Regards
>Santosh
>--
>/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\
>¦ Santosh Kharolkar ¦
>¦~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~¦
>¦ 45, Grosspeter Strasse, ¦ Tata Consultancy Services ¦
>¦ CH-4052, Basel, Switzerland. ¦ 54B Hadapsar Industrial Estate ¦
>¦ Ph : +41 (61) 3136421 (R) (GMT+1) ¦ Pune 411013 India. ¦
>¦ +41 (61) 288-1298 (O) ¦ Ph : +91 (20) 671058 (GMT+5.30) ¦
>¦ Fax: +41 (61) 288-1894 (O) ¦ Fax: +91 (20) 610921 ¦
>¦ eFax: +1 (360) 397-7552 ¦ ¦
>¦~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~¦
>¦ Email : kharolkar_at_cheerful.com ¦
>¦ Web : http://members.tripod.com/kharolkar ¦
>¦ Company : http://www.tcs.com http://www.pune.tcs.co.in ¦
>\~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/
Received on Wed Sep 01 1999 - 13:53:34 CEST

Original text of this message