602SQL Documentation Index  

ROLLBACK Statement

statement_ROLLBACK ::= ROLLBACK [ WORK ] [ AND [ NO ] CHAIN ] [ TO SAVEPOINT savepoint ] ;

The ROLLBACK statement will perform one of the following actions depending on the specification of the savepoint:

The execution of the ROLLBACK statement has no effect on variable values and on actions made outside the database in this transaction.

The ROLLBACK statement without a specified savepoint will delete all savepoints created inside the transaction. The ROLLBACK statement with a savepoint specified will delete all savepoints created after the specified savepoint (the specified savepoint will be preserved).

The WORK keyword has no effect and is only included for compatibility reasons.

If the AND CHAIN clause is specified, a new transaction with the same properties will begin after the current transaction is terminated. The AND CHAIN clause is not applicable when a savepoint is specified.

If the ROLLBACK statement without a specified savepoint is executed inside an atomic block or a trigger, the error sqlstate 2D000 occurs. If the ROLLBACK statement with a specified savepoint is executed inside an atomic block, and the savepoint was created before this atomic block was executed, or if the savepoint is not defined, the error sqlstate 3B001 occurs.