On-Message Trigger
Description
Fires whenever Oracle Forms would normally cause a message to display and pre-empts the message.
Definition Level form, block, or item
Legal Commands
SELECT statements, unrestricted Built-ins
Enter Query Mode yes
Usage Notes
Use an On-Message trigger for the following purposes:
- to trap and respond to an informative message
- to replace a standard informative message with a custom message
- to exclude an inappropriate message
- Use the MESSAGE_CODE, MESSAGE_TEXT,
MESSAGE_TYPE Built-ins in an On-Message
trigger to identify the occurrence of a specific message condition.
- If you use the On-Message trigger to trap a message so that it does not
display on the message line, the GET_MESSAGE
Built-in does not return a value. To display the current message from this
trigger, you must trap the message and explicitly write it to the display
device.
- In most cases, On-Message triggers should be attached to the form, rather
than to a block or item. Trapping certain errors at the block or item level
can be difficult if these errors occur while Oracle Forms is performing
internal navigation, such as during a Commit process.
On Failure
no effect
Restriction
- The ORA-28002 message is treated as a warning and not as an error. Therefore, this message cannot be detected by the ON-MESSAGE trigger.
On-Message Trigger Examples
The following example responds to an error message by displaying an alert that
gives the user a message and gives the user the choice to continue or to stop:
DECLARE
alert_button NUMBER;
lv_errtype VARCHAR2(3) := MESSAGE_TYPE;
lv_errcod NUMBER := MESSAGE_CODE;
lv_errtxt VARCHAR2(80) := MESSAGE_TEXT;
BEGIN
IF lv_errcod = 40350 THEN
alert_button := Show_Alert('continue_alert');
IF alert_button = ALERT_BUTTON1 THEN
...
ELSE
...
END IF;
ELSE
Message(lv_errtyp||'-'||to_char(lv_errcod)||': '||lv_errtxt);
RAISE Form_Trigger_Failure;
END IF;
IF form_fatal OR form_failure THEN
raise form_trigger_failure;
END IF;
END;