Search code examples
sqldb2

Difference between BEGIN ATOMIC and BEGIN


A question regardning SQL DB2 engine.
What is the difference between

BEGIN ATOMIC
 ...code
END

And

BEGIN
  ..code
END

Solution

  • The answer can be easiliy found in the documentation:

    ATOMIC or NOT ATOMIC

    ATOMIC indicates that if an unhandled exception condition occurs in the compound statement, all SQL statements in the compound statement will be rolled back.

    NOT ATOMIC indicates that an unhandled exception condition within the compound statement does not cause the compound statement to be rolled back.