The transaction of the associated block is either complete (success) or undone (failure) when FINALLY executes.

Buffers scoped to the associated block of the FINALLY block are not available when the FINALLY block executes. This is because either the buffer was undone and released, or committed and released.

If a buffer referenced in a FINALLY block is referenced outside of the associated block, then the scope of that buffer is the smallest enclosing block outside of the associated block that encompasses all references to the buffer. Therefore, these buffers are available to the FINALLY block.

The FINALLY block itself is an undoable block with implicit ON ERROR UNDO, THROW error handling. You cannot explicitly override the ON ERROR directive for a FINALLY block.

A statement that raises ERROR or STOP within a FINALLY block causes the following to occur, unless the condition is handled within the block:

  1. UNDO the FINALLY block if it contains a transaction, which would be uncommon.
  2. LEAVE the associated block.
  3. THROW the condition to the block enclosing the associated block, or to the caller if there is no outer block.