COMMIT statement ends the logical unit of work.
Commit in SQL
EXEC SQL
COMMIT WORK
END-EXEC
- The COMMIT will close all the locks that are acquired, except the cursors used with CURSOR WITH HOLD
- COMMIT we should not use in stored procedures
ROLLBACK in SQL
EXEC SQL
ROLLBACK WORK
END-EXEC
- It rolls back all the changes made to its last Save Point
- In DB2, when abend occurs DB2 will do all the changes ROLLBACK implicitly
- Ends logical unit of work
- Cursors open with WITH HOLD will not be closed in IMS/CICS-when no work is performed since last commit point