Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error Handling in Forms

MaahjoorMay 20 2013 — edited May 22 2013
Dear all,
we are using oracle developer suite 10g r2 with oracle database 10g r2 against windows server 2003.
Error handling is a very big issue.
i try to do the following, just correct me, or make the trigger more efficient.
i face unexpected messages, like a message two time displayed, sometime important message never displayed.
i just set the :system.message_level =20 in the when-new-form-instance trigger.
and create on-error trigger like below
declare
errcode number:=error_code;dbmserrcode number;dbmserrtext varchar2(200);
formtxt varchar2(200);
errtype varchar2(3);
begin


--------- user defined database exceptions errors raised by --RAISE_APPLICATION_ERROR

IF DBMS_ERROR_CODE in (-20738,.......) then
raise form_trigger_failure;
end if;
if error_code=50017 then
message('duration must be between 0 and 23');message(' ',no_acknowledge);
raise form_trigger_fialure;
elsif
error_code=40202 then
clear_message;
message('please provide the required fields.');message(' ',no_acknowledge);
raise form_trigger_fialure;
elsif error_code=50022 then
clear_message;
message('time must be in the correct format.');message(' ',no_acknowledge);
raise form_trigger_fialure;
end if;
if error_code in (40509,40508) then
dbmserrcode:=dbms_error_code; dbmserrtext:=dbms_error_text;
if dbmserrcode=-1438 then
clear_message;
message('your number is too large.try again.');message(' ',no_acknowledge);
raise form_trigger_fialure;
elsif dbmserrcode=-1400 then
clear_message;
message('your forgot to provide a value.try again.');message(' ',no_acknowledge);
raise form_trigger_fialure;
elsif dbmserrcode=-2291 then
clear_message;
message('header is not found for this insertion.');message(' ',no_acknowledge);
raise form_trigger_fialure;
elsif dbmserrcode=-1 then
clear_message;
message('record already exists');message(' ',no_acknowledge);
raise form_trigger_fialure;
else
clear_message;
message(error_code||' : '||error_text);message(' ',no_acknowledge);
raise form_trigger_fialure;
end if;
else
clear_message;
message(error_code||' : '||error_text);message(' ',no_acknowledge);
raise form_trigger_fialure;
end if;
exception
when others then
if dbms_error_code=-20738 then
clear_message;
message('Error: absent or later record errror from the database trigger.);
raise form_trigger_failure;
elsif .....
......
....
esle
clear_message;
message(error_code||' : '||error_text);message(' ',no_acknowledge);
raise form_trigger_fialure;
end if;
end;
any suggession?
Regards
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 19 2013
Added on May 20 2013
9 comments
9,176 views