The ROUTINE-LEVEL ON ERROR UNDO, THROW statement is very similar to BLOCK-LEVEL ON ERROR UNDO, THROW, but it affects only a subset of block types. Specifically, this statement changes the default behavior for the following blocks:

  • Procedure (also called main block, external procedure, or .p file, including database trigger .p files)
  • Internal procedure
  • Database trigger (ON block with CREATE, DELETE, WRITE, or ASSIGN event)
  • User-defined function
  • Constructor
  • User-defined method
  • User-defined property getter/setter

The following blocks are not affected:

  • Any block for which an error-handling directive is explicitly specified
  • REPEAT
  • FOR
  • DO TRANSACTION
  • Simple DO block
  • DO WHILE block
  • Destructor
  • UI trigger

Syntax

ROUTINE-LEVEL ON ERROR UNDO, THROW.

The same rules that affect the placement of the BLOCK-LEVEL ON ERROR UNDO, THROW statement also apply to ROUTINE-LEVEL ON ERROR UNDO, THROW:

  • The statement occurs once in each .p or .cls file in which the behavior is desired.
  • The statement must come before any definitional or executable statement in the procedure or class file.
  • The statement can come before or after a USING statement.
Note: The ROUTINE-LEVEL ON ERROR UNDO, THROW statement is ignored if BLOCK-LEVEL ON ERROR UNDO, THROW occurs in the same file.