Home » Developer & Programmer » Forms » displaying message (forms 6i)
displaying message [message #397486] Sat, 11 April 2009 04:22 Go to next message
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?



Re: displaying message [message #397736 is a reply to message #397486] Mon, 13 April 2009 11:46 Go to previous messageGo to next message
jagadeeshg
Messages: 14
Registered: December 2007
Location: BLR
Junior Member

DBMS_ERROR_CODE return always negative number.

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 = -1 THEN
MESSAGE('Duplicate Employee');
END IF;
END IF;
END;
The above change will work.

Re: displaying message [message #397786 is a reply to message #397736] Mon, 13 April 2009 23:10 Go to previous message
sivajyothi.kalikiri
Messages: 29
Registered: March 2009
Junior Member
Thank u, Now it's working........
Previous Topic: call report 6i from Form 10g
Next Topic: Hierachical trees in forms
Goto Forum:
  


Current Time: Fri Dec 09 17:46:07 CST 2016

Total time taken to generate the page: 0.34571 seconds