SQL/MX 2.x Reference Manual (G06.24+, H06.03+)
SQL/MX Statements
HP NonStop SQL/MX Reference Manual—523725-004
2-176
ROLLBACK WORK Statement
ROLLBACK WORK Statement
Considerations for ROLLBACK WORK
MXCI Examples of ROLLBACK WORK
C Examples of ROLLBACK WORK
COBOL Examples of ROLLBACK WORK
The ROLLBACK WORK statement undoes all database modifications 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.
ROLLBACK WORK has no effect if there is no active transaction.
ROLLBACK 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 ROLLBACK WORK
Begin and End a Transaction
BEGIN WORK starts a transaction. COMMIT WORK or ROLLBACK WORK ends a 
transaction. 
MXCI Examples of ROLLBACK WORK
•
Suppose that you add an order for two parts numbered 4130 to the ORDERS and 
ODETAIL tables. When you update the PARTLOC table to decrement the quantity 
available, you discover there is no such part number in the given location.
Use ROLLBACK WORK to terminate the transaction without committing the 
database changes:
BEGIN WORK;
INSERT INTO sales.orders 
 VALUES (124, DATE '1996-04-10',
 DATE '1996-06-10', 75, 7654);
INSERT INTO sales.odetail
 VALUES (124, 4130, 25000, 2);
UPDATE invent.partloc 
 SET qty_on_hand = qty_on_hand - 2 
ROLLBACK [WORK] 
Embed










