Home » SQL & PL/SQL » SQL & PL/SQL » How to ensure uniqueness on RAISE_APPLICATION_ERROR
How to ensure uniqueness on RAISE_APPLICATION_ERROR [message #670710] Mon, 23 July 2018 00:28 Go to previous message
ramya29p
Messages: 146
Registered: November 2007
Location: Chennai
Senior Member
Hi ,
CREATE OR REPLACE PACKAGE p_exception

error_no1 NUMBER := -20001;
error_no2 NUMBER := -20002;
error_no3 NUMBER := -20003;
error_no1 NUMBER := -20004;

error_msg1 varchar2(100) := 'Message 1';
error_msg2 varchar2(100) := 'Message 2';
error_msg3 varchar2(100) := 'Message 3';
error_msg4 varchar2(100) := 'Message 4';

END;
/

CREATE OR REPLACE PACKAGE BODY p_exception
PROCEDURE raise_exception(p_error_in NUMBER, p_message VARCHAR2 DEFAULT NULL) AS
    
  BEGIN   
   
    RAISE_APPLICATION_ERROR(p_error_in, p_message);
    
    END;
END;

I have create the above package for ensuring uniqueness while raising RAISE_APPLICATION_ERROR. raise_exception procedure would be called from different package.

Do we have any alternative way other than creating package to ensure uniqueness while raising RAISE_APPLICATION_ERROR.

I don't want to use the same Error number for throwing a another exception.

For Example if -200001 is already used then I don't want to use the same number for throwing another exception.


Could anyone suggest.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: passing date value to the query from sql*plus
Next Topic: Possibility of Name
Goto Forum:
  


Current Time: Wed Apr 24 16:15:15 CDT 2024