Undoing Changes
Go Up to Closing Transactions
The ROLLBACK statement undoes a transaction’s changes, ends the current transaction, and closes open cursors. Use ROLLBACK when an error occurs that prevents all of a transaction’s operations from being successful. To end a transaction with ROLLBACK, use the following syntax:
EXEC SQL ROLLBACK TRANSACTION name;
For example, the following statement rolls back a transaction named MYTRANS:
EXEC SQL ROLLBACK TRANSACTION MYTRANS;
To roll back an unnamed transaction (i.e., the default transaction), use the following statement:
EXEC SQL ROLLBACK;
For a complete discussion of SQL transaction control, see Working with Transactions.