SQL/MX 2.x Reference Manual (G06.24+, H06.03+)
SQL/MX Statements
HP NonStop SQL/MX Reference Manual—523725-004
2-226
MXCI Examples of SET TRANSACTION
MXCI 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 these DELETE,
INSERT, and UPDATE statements are committed.
C Examples of SET TRANSACTION
•
Set the access option and isolation level for the next transaction within the
program:
EXEC SQL SET TRANSACTION
READ ONLY,
ISOLATION LEVEL READ UNCOMMITTED;
COBOL Examples of SET TRANSACTION
•
Set the access option and isolation level for the next transaction within the
program:
EXEC SQL SET TRANSACTION
READ ONLY,
ISOLATION LEVEL READ UNCOMMITTED
END-EXEC.