Syntax options:
ATOMIC | NOT ATOMIC
Controls whether or not SQL statements in the compound statement
are undone when any statement in the compound statement
terminates with an exception. Compound statements are NOT ATOMIC
by default.
Most single SQL statements are ATOMIC. Only the control
statements are NOT ATOMIC. For example, an INSERT statement is
ATOMIC, and the entire insert operation either completes or fails
as a unit even if it is contained in a NOT ATOMIC block.
o ATOMIC
In a compound statement defined as ATOMIC, all SQL statements
in a compound statement succeed, or when any of the SQL
statements in the compound statement raises an exception,
they all fail as a unit. Any changes made up to the point
of failure are undone. SQL terminates the compound statement
as soon as a statement within it fails. SQL does not change
variable assignments as a result of a statement failure.
All statements within an ATOMIC block must be atomic. If you
nest compound statements and specify ATOMIC, you must specify
ATOMIC for any inner blocks. If you do not, Oracle Rdb returns
an error.
o NOT ATOMIC (default)
In a compound statement defined as NOT ATOMIC, all SQL
statements that complete successfully up to the point of a
failed statement are not undone as they would be in an ATOMIC
compound statement. Partial success of the statements in a
NOT ATOMIC compound statement can occur, unlike the all-
or-nothing behavior in ATOMIC compound statements. As with
ATOMIC compound statements, NOT ATOMIC compound statements
are terminated when an SQL statement returns an exception. The
partial work of the statement causing a compound statement to
terminate is always undone.
SQL restricts the use of SET TRANSACTION, START TRANSACTION,
COMMIT, and ROLLBACK statements to NOT ATOMIC compound statements
because the nature of an ATOMIC compound statement conflicts with
the properties of these statements. The property of an ATOMIC
block is that all statements succeed, or all statements fail, and
this can not be guaranteed if a transaction is started or ended
during the block.