Normally we use this line of code to report message in database trigger.
*************************************************************
IF(DEF = ABC) THEN
RAISE_APPLICATION_ERROR(-1986, ' Your can not Insert Record Here' );
END IF;
*************************************************************
That's easy you just did half the solution and u need to do the other half on the form level
so u need to :
1-add the on_error trigger on the form level
2-write this code in it
*************************************************************
declare
errcode NUMBER := ERROR_CODE;
dbmserrcode NUMBER;
dbmserrtext VARCHAR2(200);
begin
/*find what is the errorcode the form raises ,
you can do that by showwing it in a message ,
then when u know it make the 1st if condition on it*/
IF errcode = 40509 THEN
dbmserrcode := DBMS_ERROR_CODE;
dbmserrtext := DBMS_ERROR_TEXT; end if;
/*then make sure the second if condition is on the same errorcode
you set in you database trigger */
IF dbmserrcode =-1986 THEN
message('Your can not Insert Record Here' );
Raise form_trigger_failure;
end if;
end;
No comments:
Post a Comment