SQL/MX 2.x Reference Manual (G06.24+, H06.03+)
SQL/MX Statements
HP NonStop SQL/MX Reference Manual—523725-004
2-32
COMMIT WORK Statement
COMMIT WORK Statement
Considerations for COMMIT WORK
MXCI Examples of COMMIT WORK
C Examples of COMMIT WORK
COBOL Examples of COMMIT WORK
The COMMIT WORK statement commits any changes to audited objects made during
the current transaction, releases all locks on audited objects held by the transaction,
and ends the transaction. See Transaction Management on page 1-11.
WORK is an optional keyword that has no effect.
COMMIT WORK has no effect outside of an active transaction.
COMMIT WORK closes all open cursors or SQLJ iterators in the application, because
cursors and iterators do not span transaction boundaries. You cannot fetch with a
cursor or iterator after a transaction ends without reopening the cursor or re-initializing
the iterator.
Considerations for COMMIT WORK
Begin and End a Transaction
BEGIN WORK starts a transaction. COMMIT WORK or ROLLBACK WORK ends a
transaction.
Effect of Constraints
When COMMIT WORK is executed, all active constraints are checked, and if any
constraint is not satisfied, changes made to the database by the current transaction are
canceled—that is, work done by the current transaction is rolled back. If all constraints
are satisfied, all changes made by the current transaction become permanent.
MXCI Examples of COMMIT WORK
•
Suppose that your application adds information to the inventory. You have received
24 terminals from a new supplier and want to add the supplier and update the
quantity on hand. The part number for the terminals is 5100, and the supplier is
assigned supplier number 17. The cost of each terminal is $800.
COMMIT [WORK]
Embed