SAVEPOINT v17
Name
SAVEPOINT
— Define a new savepoint in the current transaction.
Synopsis
Description
SAVEPOINT
establishes a new savepoint in the current transaction.
A savepoint is a mark inside a transaction that allows all commands that are executed after it to be rolled back. This restores the transaction state to what it was at the savepoint.
Parameters
savepoint_name
The name ofo the savepoint.
Notes
Use ROLLBACK TO SAVEPOINT
to roll back to a savepoint.
You can establish savepoints only when inside a transaction block. You can define multiple savepoints in a transaction.
When another savepoint is established with the same name as a previous savepoint, the old savepoint is kept. However, only the more recent one is used when rolling back.
SAVEPOINT
isn't supported in SPL programs.
Examples
Establish a savepoint and then undo the effects of all commands executed after it:
This transaction commits a row into the dept
table. The inserts into the emp
and jobhist
tables are rolled back.