SAVEPOINT

SAVEPOINT — define a new savepoint within the current transaction

Syntax

SAVEPOINT savepoint_name

Description

SAVEPOINT establishes a new savepoint within the current transaction.
A savepoint is a special mark inside a transaction that allows all commands that are executed after it was established to be rolled back, restoring the transaction state to what it was at the time of the savepoint. There can be multiple savepoints defined within a transaction.
Use COMMIT to release all savepoints and commit all database changes for the current transaction (See COMMIT).
Use ROLLBACK TO SAVEPOINT to rollback to a previously specific savepoint within the current transaction (See ROLLBACK). Use ROLLBACK to rollback all changes for the current transaction, regardless of savepoints in the current transaction.
Use RELEASE SAVEPOINT to destroy a savepoint (See RELEASE SAVEPOINT), keeping the effects of commands executed after it was established. In other words, releasing the savepoint does not commit or rollback database changes for the current transaction.