Explicit Transactions; Degree Of Concurrency; Effect On Utilities; Example Of Set Transaction - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

The exceptions (statements that are not transaction initiating) are:
COMMIT, FETCH, ROLLBACK, and SET TRANSACTION
DML statements executing under READ UNCOMMITTED access
EXECUTE or EXECUTE IMMEDIATE, which are transaction initiating only if the associated
statement is transaction-initiating

Explicit Transactions

You can issue an explicit BEGIN WORK even if the autocommit option is on. The autocommit
option is temporarily disabled until you explicitly issue COMMIT or ROLLBACK.

Degree of Concurrency

The SET TRANSACTION statement affects the degree of concurrency available to the transaction
. Concurrent processes take place within the same interval of time and share resources. The
degree of concurrency available—that is, whether a process that requests access to data already
being accessed is given access or placed in a wait queue—is affected by:
The transaction access mode (READ ONLY or READ WRITE)
The transaction isolation level (READ UNCOMMITTED, READ COMMITTED,
SERIALIZABLE, or REPEATABLE READ)

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.

Example 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.
168
SQL Statements

Advertisement

Table of Contents
loading

Table of Contents