Adds an in-memory savepoint to the current transaction.
The unique name of the savepoint.
- Savepoints can be used to undo subsets of a batched transaction.
- Savepoint names must be unique within a database, use a RELEASE SAVEPOINT command to release them.
- Savepoints don't persist after a database recovery.
A. Rolling back a transaction to a savepoint.
The following example shows the effect of rolling back a transaction to a savepoint. In this example, the ROLLBACK statement will rolls back the transaction to
my first savepoint.
The second insertion will be undone and while the first will persist until it is either rolled back or committed.
This example uses the Financial Demo Database.
SET AUTOCOMMIT = 0
VALUES ("WPG", "Washington Prime Group", "Trust")
SAVEPOINT "my first savepoint"
INSERT financial.companies VALUES ("POLA", "Polar Power, Inc", "Industrial")
ROLLBACK TO "my first savepoint"