displaying message [message #397486] |
Sat, 11 April 2009 04:22 |
sivajyothi.kalikiri
Messages: 29 Registered: March 2009
|
Junior Member |
|
|
Hi,
I wanted to display a message when it violates unique constraint as 'duplicate record';
i tried the folloeing code in 'ON-ERROR' trigger
DECLARE
errcode NUMBER:= ERROR_CODE;
dbmserrcode NUMBER;
dbmserrtext VARCHAR2(200);
BEGIN
IF errcode = 40508
THEN
dbmserrcode := DBMS_ERROR_CODE;
dbmserrtext := DBMS_ERROR_TEXT;
IF dbmserrcode = 00001
THEN
MESSAGE('Duplicate Employee');
END IF;
END IF;
END;
It's not working. i tried the following code in 'SAVE_BUTTON_PRESSED'
IF DBMS_ERROR_CODE = -1
THEN -- If it is unique key erroe
IF INSTR(DBMS_ERROR_TEXT, 'uk_m_authority_emp_code') >= 1
THEN
MESSAGE('Duplicate Employee');
go_item('M_AUTHORITY.EMP_CODE');
END IF;
END IF;
With this code also i am not able to display the message,
what's wrong in my code?
|
|
|
|
|