Effect on Utilities
The SET TRANSACTION statement has no effect on the utility statements. The SET
TRANSACTION statement does set attributes for transactions for UPDATE STATISTICS.
Examples of SET TRANSACTION
•
Set the isolation level of a transaction that performs deletes, inserts, and updates:
SET TRANSACTION
ISOLATION LEVEL SERIALIZABLE;
--- SQL operation complete.
BEGIN WORK;
--- SQL operation complete.
DELETE FROM persnl.employee
WHERE empnum = 23;
--- 1 row(s) deleted.
INSERT INTO persnl.employee
(empnum, first_name, last_name, deptnum, salary)
VALUES (50, 'JERRY','HOWARD', 1000, 137000.00);
--- 1 row(s) inserted.
UPDATE persnl.dept
SET manager = 50
WHERE deptnum = 1000;
--- 1 row(s) updated.
COMMIT WORK;
--- SQL operation complete.
This transaction uses SERIALIZABLE access (which provides maximum consistency but
reduces concurrency). Therefore, you should execute it at a time when few users need
concurrent access to the database. Locks acquired for SERIALIZABLE access are held until
the changes made by transaction is committed.
•
Using MULTI COMMIT with other transaction-mode options:
SET TRANSACTION ISOLATION READ COMMITTED,
192
SQL Statements
MULTI COMMIT ON,
READ WRITE;