A script-enabled browser is required for this page to function properly.

On-Error Trigger

Description

An On-Error trigger fires whenever Oracle Forms would normally cause an error message to display.

Replaces

The writing of an error message to the message line.

Definition Level form, block, or item

Legal Commands

SELECT statements, unrestricted Built-ins

Enter Query Mode yes

Usage Notes

Use an On-Error trigger for the following purposes:

Use the ERROR_CODE , ERROR_TEXT , ERROR_TYPE , DBMS_ERROR_TEXT , or DBMS_ERROR_CODE Built-in function in an On-Error trigger to identify a specific error condition.

On Failure

no effect

Restriction

On-Error Trigger Example

The following example checks specific error message codes and responds appropriately.

DECLARE
lv_errcod NUMBER := ERROR_CODE;
lv_errtyp VARCHAR2(3) := ERROR_TYPE;
lv_errtxt VARCHAR2(80) := ERROR_TEXT;
BEGIN
IF (lv_errcod = 40nnn) THEN
/*
** Perform some tasks here
*/
ELSIF (lv_errcod = 40mmm) THEN
/*
** More tasks here
*/
...
...
ELSIF (lv_errcod = 40zzz) THEN
/*
** More tasks here
*/
ELSE
Message(lv_errtyp||'-'||to_char(lv_errcod)||': '||lv_errtxt);
RAISE Form_Trigger_Failure;
END IF;
END;