Skip to content

Rolling back to a Savepoint

Rolling back to a savepoint undoes every change made after that savepoint, while keeping the savepoint and the surrounding transaction active. Use it to unwind one stage of your work and try again, without losing everything you did earlier in the transaction.

To roll back to a savepoint:

  1. Select the database in the tree panel.
  2. Choose Transaction → Rollback to… from the main menu.
  3. Select the name of the savepoint to roll back to.

Everything after the savepoint is discarded; everything before it remains, and the transaction stays open so you can carry on.

You can also do this from a script with ROLLBACK TO:

SAVEPOINT before_import;

INSERT INTO customer (CustNo, Company, City) VALUES (9001, 'Blue Lagoon Divers', 'Male');
INSERT INTO customer (CustNo, Company, City) VALUES (9002, 'Coral Key Charters', 'Nassau');

ROLLBACK TO before_import;   -- undo both inserts, but stay in the transaction

After the ROLLBACK TO, the two new customers are gone, but the savepoint before_import still exists and the transaction is still active.

Tip

Rolling back to a savepoint is different from a plain rollback: a plain rollback abandons the entire transaction, while rollback to rewinds only to the marker and lets you continue.

See also: Creating a savepoint · Releasing a savepoint