Once a trigger fires, it can end with either success or failure. A trigger fails when it raises an unhandled exception. When this occurs, Oracle Forms aborts the trigger and performs the appropriate post-failure processing. The specific processing that Oracle Forms performs depends on the type of trigger that failed.
The following table shows the post-failure processing for three types of triggers:
Trigger Type |
Result of Trigger Failure |
---|---|
Key - * (any key trigger) |
Trigger failure is ignored. |
Pre-Item |
Oracle Forms attempts to return input focus to the source item. |
On-Insert |
Oracle Forms rolls back all database changes posted by the current commit process and attempts to navigate to the first item in the current record of the block in error. |
When-Validate-Item |
Item validation fails. Oracle Forms sets the error location. When possible, input focus is returned to the source item. |
When a trigger fails, Oracle Forms tries to undo any conditions that would cause a runtime error as a result of the trigger's failure.
For example, the Pre-Item trigger fires when Oracle Forms attempts to move the input focus from a source item to a target item. When a Pre-Item trigger fails, navigation cannot be completed successfully, so Oracle Forms returns the input focus to the source item.
Similarly, when a commit processing trigger such as On-Insert fails, Oracle Forms performs the appropriate rollback to ensure data integrity.