SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
B-3
BEGIN WORK Statement
BEGIN WORK Statement
BEGIN WORK is a transaction control statement that starts a user-defined TMF
transaction.
A user-defined TMF transaction groups a set of operations on audited objects and files
so that changes made by the operations can be committed (with the COMMIT WORK
statement) or rolled back (with the ROLLBACK WORK statement) as a unit. TMF
transactions do not protect nonaudited tables. For more information on TMF
transactions, see TMF Transactions on page T-6.
Example—BEGIN WORK
This example uses BEGIN WORK in SQLCI to group three separate statements that
update the database into a single TMF transaction:
>> VOLUME SALES;
>> BEGIN WORK;
>> INSERT INTO ORDERS VALUES (124, 860323, 860330, 75, 7654);
--- 1 ROW(S) INSERTED.
>> INSERT INTO ODETAIL VALUES (124, 4103, 25000, 2);
--- 1 ROW(S) INSERTED.
>> UPDATE INVENT.PARTLOC SET QTY_ON_HAND = QTY_ON_HAND -2
+> WHERE PARTNUM = 4103 AND LOC_CODE = "K43";
--- 1 ROW(S) UPDATED.
>> COMMIT WORK;
BEGIN WORK