Sets a transaction save point to which a current transaction can be rolled back, resulting in a partial roll back.
Syntax:
>>---EXEC SQL-SAVEPOINT-name---->
>--.-----------------------------------------------------------.---END-EXEC---><
+--ON ROLLBACK RETAIN CURSORS--.----------------------------+
+--ON ROLLBACK RETAIN LOCKS--+
>>---EXEC SQL-SAVE-.-TRANSACTION--.--name-- END-EXEC---><
+-TRAN---------+
Example:
EXEC SQL
SAVEPOINT SP1
END-EXEC
EXEC SQL
SAVEPOINT PHASE2 ON ROLLBACK RETAIN CURSORS
END-EXEC
Comments:
You can define multiple save points for a single transaction.
When you set a save point using a unique name, and subsequently set another save point using the same unique name, the named save point is reset to the current transaction state.
The behavior of cursors and locks after a rollback to a save point is database-specific. For details, see the documentation provided by your database vendor.