SAVEPOINT defines a point in a transaction to which you can roll back.
ROLLBACK,
SAVEPOINT,
and
RELEASE are supported at the session level (outside of stored procedures) only if AUTOCOMMIT is off. Otherwise,
ROLLBACK,
SAVEPOINT,
and
RELEASE must be used within a stored procedure.
A SAVEPOINT applies only to the procedure in which it is defined. That is, you cannot reference a
SAVEPOINT defined in another procedure.
The following example sets a SAVEPOINT then checks a condition to determine whether to
ROLLBACK or to
RELEASE the
SAVEPOINT.