Home » Developer & Programmer » Forms » TRAPING DBMS ERRORS FROM ON ERROR TRIGGER (DEVELOPER 10G WINDOWS XP)
TRAPING DBMS ERRORS FROM ON ERROR TRIGGER [message #437362] Mon, 04 January 2010 00:56 Go to next message
ANACONDA_DELIGHT
Messages: 3
Registered: January 2010
Location: saudi arabia
Junior Member
HELLO ALL
I have create a database trigger in which i raise the following error
raise_application_error(-20745,'attendance for the same employee has already entered in the same date and type.');

(i want to trap this error in the form.)

i have created KEY-COMMIT trigger
here is the code

:system.message_level:='25';
commit_form;
if form_success then
message('Record is saved.');
else
message('Record is not saved.');
raise form_trigger_failure);
end if;

i have another trigger ON-ERROR below is some of the code

Declare
errcode number:=ERROR_CODE;
dbmserrcode number;
dbmserrtxt varchar2(200);
begin
:system.message_level:=20;
if errcode=40508 then
dbmserrcode=DBMS_ERROR_CODE; dbmserrtext:=DBMS_ERROR_TEXT;
if dbmserrcode=-1438 then
message('your number is too large.try again.');
raise form_trigger_failure;
......
.....
end if;
if DBMS_ERROR_CODE=20745 THEN
MESSAGE(SUBSTR(DBMS_ERROR_TEXT,11,80));
RAISE FORM_TRIGGER_FAILURE;
END IF;
EXCEPTION
WHEN OTHERS THEN


MESSAGE(SUBSTR(DBMS_ERROR_TEXT,11,80));
RAISE FORM_TRIGGER_FAILURE;
END;


i want to trap this error and retreive the desired message to the user.
need help

Thanks & Regards.

Re: TRAPING DBMS ERRORS FROM ON ERROR TRIGGER [message #437404 is a reply to message #437362] Mon, 04 January 2010 05:10 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
So what is the problem? You have code that is trying to do what you're asking. What is it actually doing?
Re: TRAPING DBMS ERRORS FROM ON ERROR TRIGGER [message #437767 is a reply to message #437362] Tue, 05 January 2010 23:25 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
And post your code using the available 'code' tags.

David
Previous Topic: FRM 10102 ERROR
Next Topic: Excel doen't close under Task manager Processes after exporting
Goto Forum:
  


Current Time: Thu Sep 19 22:33:09 CDT 2024