Examples

Example 1: See the Example under COMMIT for examples using the ROLLBACK statement.

Example 2: After a unit of recovery started, assume that three savepoints A, B, and C were set and that C was released:

   SAVEPOINT A ON ROLLBACK RETAIN CURSORS;
   ...
   SAVEPOINT B ON ROLLBACK RETAIN CURSORS;
   ....
   SAVEPOINT C ON ROLLBACK RETAIN CURSORS;
   ...
   RELEASE SAVEPOINT C

Roll back all database changes only to savepoint A:

   ROLLBACK WORK TO SAVEPOINT A

If a savepoint name was not specified (that is, ROLLBACK WORK TO SAVEPOINT), the rollback would be to the last active savepoint that was set, which is B.