Neoview SQL Reference Manual (R2.4 SP2)
ROLLBACK WORK Statement
• “Syntax Description of REVOKE SCHEMA”
• “Considerations for ROLLBACK WORK”
• “Example of ROLLBACK WORK”
The ROLLBACK WORK statement undoes all database modifications to objects made during
the current transaction, releases all locks on objects held by the transaction, and ends the
transaction. See “Transaction Management” (page 28).
Syntax Description of ROLLBACK WORK
ROLLBACK [WORK]
WORK is an optional keyword that has no effect.
ROLLBACK WORK issued outside of an active transaction generates error 8609.
Considerations for ROLLBACK WORK
Begin and End a Transaction
BEGIN WORK starts a transaction. COMMIT WORK or ROLLBACK WORK ends a transaction.
Example 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 '2007-04-10',
DATE '2007-06-10', 75, 7654);
INSERT INTO sales.odetail
VALUES (124, 4130, 25000, 2);
UPDATE invent.partloc
SET qty_on_hand = qty_on_hand - 2
WHERE partnum = 4130 AND loc_code = 'K43';
ROLLBACK WORK;
ROLLBACK WORK cancels the insert and update that occurred during the transaction and
releases the locks held on ORDERS, ODETAIL, and PARTLOC.
162 SQL Statements