Sunday, October 11, 2015

Reword certain FRM error messages by checking the Error_Code in an ON-ERROR trigger

/* 

** Built-in:  ERROR_CODE,ERROR_TEXT,ERROR_TYPE
** Example:   Reword certain FRM error messages by checking
**            the Error_Code in an ON-ERROR trigger
** Trigger:   On-Error
*/
DECLARE
  errnum NUMBER       := ERROR_CODE;
  errtxt VARCHAR2(80) := ERROR_TEXT;
  errtyp VARCHAR2(3)  := ERROR_TYPE;
BEGIN
  IF errnum = 40301 THEN
    Message('Your search criteria identified no matches...
              Try Again.');
  ELSIF errnum = 40350 THEN
    Message('Your selection does not correspond to an employee.');
  ELSE
    /*
    ** Print the Normal Message that would have appeared
    **
    ** Default Error Message Text Goes Here
    */
    Message(errtyp||'-'||TO_CHAR(errnum)||': '||errtxt);
    RAISE Form_Trigger_Failure;
  END IF;
END;

No comments:

Post a Comment