Name
SAVEPOINT — Place a save-point marker in the transaction command sequence
Syntax
Common Usage
SAVEPOINT savepoint_name;Description
The SAVEPOINT command creates a save-point marker
in the transaction log. If there is no active transaction in
progress, the save-point will be marked and an implicit BEGIN DEFERRED TRANSACTION will
be issued.
Save-points allow subsections of a transaction to be rewound and partially rolled back without losing the entire transaction state. A transaction can have multiple active save-points. Conceptually, these save-points act as if they were on a stack. Save-point names do not need to be unique.
Save-points are useful in multistep processes where each step needs to be attempted and verified before proceeding to the next step. By creating save-points before starting each step, it may be possible to revert just a single step, rather than the whole transaction, when a logical error case is encountered.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access