Skip to main content
Skip table of contents

Compound Statement

A compound statement or block logically groups a series of statements. Temporary tables and variables created in a compound statement are local only to that block and are destroyed when exiting the block.

Usage

SQL
[label :] BEGIN [[NOT] ATOMIC]
    statement*
[EXCEPTION ex
    statement*
]
END
When a block is expected by an IF, LOOP, WHILE, etc. a single statement is also accepted by the parser. Even though the block BEGIN/END is not expected, the statement will execute as if wrapped in a BEGIN/END pair.

Syntax

  • If NOT ATOMIC or no ATOMIC clause is specified, the block will be executed non-atomically;
  • If ATOMIC is specified the block must execute atomically. If a transaction is already associated with the thread, no additional action will be taken - savepoints and/or sub-transactions are not currently used;
  • Otherwise, a transaction will be associated with the execution of the block;
  • The label must not be the same as any other label used in statements containing this one.
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.