SAVEPOINT v11
Name
SAVEPOINT
-- define a new savepoint within the current transaction.
Synopsis
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.
Parameters
savepoint_name
The name to be given to the savepoint.
Notes
Use ROLLBACK TO SAVEPOINT
to roll back to a savepoint.
Savepoints can only be established when inside a transaction block. There can be multiple savepoints defined within a transaction.
When another savepoint is established with the same name as a previous savepoint, the old savepoint is kept, though only the more recent one will be used when rolling back.
SAVEPOINT
is not supported within SPL programs.
Examples
To establish a savepoint and later undo the effects of all commands executed after it was established:
The above transaction will commit a row into the dept
table, but the inserts into the emp
and jobhist
tables are rolled back.
See Also