SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Statements
HP NonStop SQL/MX Reference Manual540440-003
2-30
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-12.
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 in the application, because cursors do not
span transaction boundaries. You cannot fetch with a cursor after a transaction ends
without reopening the cursor.
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