SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
C-57
Considerations—COMMIT WORK
To unlock all audited tables in any condition, ADD a DEFINE named
=_SQL_AUDITONLY_CLOSE_CR and run the COMMIT WORK AUDITONLY
command again.
Considerations—COMMIT WORK
BEGIN WORK starts a transaction. COMMIT WORK or ROLLBACK WORK ends a
transaction. For more information, see TMF Transactions on page T-6.
COMMIT WORK does not cause a write to disk.
Within a host program, using COMMIT WORK is equivalent to using these
sequence of statements:
FREE RESOURCES (an SQL statement)
ENDTRANSACTION procedure call
COMMIT WORK returns status information to the SQLCA so you can use
WHENEVER to check for error conditions.
Example—COMMIT WORK
Suppose that your application adds information to the inventory. You have just 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 6402, and the supplier is assigned
supplier number 17. The cost of each terminal is $800.
The transaction must add the supplier to the SUPPLIER table, add the order for
terminals to PARTSUPP, and update QTY_ON_HAND in PARTLOC. After the
INSERT and UPDATE statements execute successfully, you commit the
transaction.
>> VOLUME INVENT;
>> BEGIN WORK;
>> INSERT INTO PARTSUPP VALUES (6402, 17, 800.00, 24);
--- 1 row(s) inserted.
>> INSERT INTO SUPPLIER VALUES (17, "Super Peripherals",
+> "4751 Sanborn Way", "Santa Rosa", "California", "95405");
--- 1 row(s) inserted.
>> UPDATE PARTLOC SET QTY_ON_HAND = QTY_ON_HAND + 24
+> WHERE PARTNUM = 6402 AND LOC_CODE = "G48";
--- 1 row(s) updated.
>> COMMIT WORK;