Name
RELEASE SAVEPOINT Statement
The RELEASE SAVEPOINT statement eliminates one or more previously created savepoints in the current transaction.
Platform | Command |
MySQL | Supported |
Oracle | Not supported |
PostgreSQL | Supported |
SQL Server | Not supported |
SQL2003 Syntax
RELEASE SAVEPOINT savepoint_nameKeywords
savepoint_nameRepresents a named savepoint (or target specification) created earlier in the transaction with the SAVEPOINT statement. The
savepoint_namemust be unique within the transaction.
Rules at a Glance
Use the RELEASE SAVEPOINT statement within a transaction to destroy a named savepoint. Any savepoints that were created after the named savepoint will also be destroyed.
To illustrate the behavior of savepoints, the following example code inserts a few records, creates a savepoint named first_savepoint, and then releases it:
INSERT authors (au_id, au_lname, au_fname, contract )
VALUES ('111-11-1111', 'Rabbit', 'Jessica', 1);
SAVEPOINT first_savepoint;
INSERT authors (au_id, au_lname, au_fname, contract )
VALUES ('277-27-2777', 'Fudd', 'E.P.', 1);
INSERT authors (au_id, au_lname, au_fname, contract )
VALUES ('366-36-3636', 'Duck', 'P.J.', 1);
RELEASE SAVEPOINT first_savepoint;
COMMIT;In this example, the first_savepoint savepoint is destroyed and then all three records are inserted into the authors table.
In the next example, we perform the same action but with more savepoints:
INSERT authors (au_id, au_lname, au_fname, contract ) VALUES ('111-11-1111', 'Rabbit', 'Jessica', 1); SAVEPOINT first_savepoint; ...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