Blocks that support CATCH blocks

The use of CATCH blocks is supported for all blocks that have error handling capabilities. CATCH cannot be used in a simple DO or DO WHILE block (one with no options), since these do not have implicit error handling; the compiler will not allow it. DO blocks must have an explicit TRANSACTION, ON ERROR UNDO, or ON STOP directive, in order to have a CATCH block.

One or more CATCH blocks are positioned at the end of the associated block. If a FINALLY block is also used, the CATCH block comes before the FINALLY block. This is the syntax for an associated block using end blocks:

Syntax

associated-block:
  .
  .
  .
  [ CATCH
    .
    .
    .
  END [ CATCH ] . ]...
  [FINALLY
    .
    .
    .
  END [ FINALLY ] . ]
END. /* associated-block */