TRAPING DBMS ERRORS FROM ON ERROR TRIGGER [message #437362] |
Mon, 04 January 2010 00:56 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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.
|
|
|
|
|