Difference between revisions of "SET TRANSACTION"
Barrymavin (Talk | contribs) (→Syntax) |
Barrymavin (Talk | contribs) (→Description) |
||
Line 21: | Line 21: | ||
==Description== | ==Description== | ||
A current transaction state can be either read-only or read-write. Three further aspects of transaction behavior are configurable: dirty reads, non-repeatable reads and phantom reads. Dirty reads occur when a transaction updates a row, then a second transaction reads that row before the first transaction commits. If the first transaction rolls back the change, the information read by the second transaction becomes invalid. Non-repeatable reads occur when a transaction reads a row then another transaction updates the same row. If the second transaction commits, subsequent reads by the first transaction get different values than the original read. Phantoms occur when a transaction reads a set of rows that satisfy a search condition and then another transaction updates, inserts, or deletes one or more rows that satisfy the first transaction’s search condition. In this case, if the first transaction performs subsequent reads with the same search condition, it reads a different set of rows. | A current transaction state can be either read-only or read-write. Three further aspects of transaction behavior are configurable: dirty reads, non-repeatable reads and phantom reads. Dirty reads occur when a transaction updates a row, then a second transaction reads that row before the first transaction commits. If the first transaction rolls back the change, the information read by the second transaction becomes invalid. Non-repeatable reads occur when a transaction reads a row then another transaction updates the same row. If the second transaction commits, subsequent reads by the first transaction get different values than the original read. Phantoms occur when a transaction reads a set of rows that satisfy a search condition and then another transaction updates, inserts, or deletes one or more rows that satisfy the first transaction’s search condition. In this case, if the first transaction performs subsequent reads with the same search condition, it reads a different set of rows. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
If you use a SET TRANSACTION statement, it must be the first statement in your transaction. | If you use a SET TRANSACTION statement, it must be the first statement in your transaction. | ||
Line 32: | Line 26: | ||
{| class="wikitable" | {| class="wikitable" | ||
+ | |+Transaction Isolation Levels | ||
|'''Keywords'''||'''Description''' | |'''Keywords'''||'''Description''' | ||
|- | |- |
Revision as of 01:44, 13 March 2009
Contents
SET TRANSACTION
Class
SQL Applications
Purpose
To set the current transaction state
Syntax
SET TRANSACTION [READ ONLY | READ WRITE]
SET TRANSACTION ISOLATION LEVEL <isolation-level>
See Also
CLOSE, DECLARE CURSOR, DROP CURSOR, FETCH, OPEN, SELECT
Description
A current transaction state can be either read-only or read-write. Three further aspects of transaction behavior are configurable: dirty reads, non-repeatable reads and phantom reads. Dirty reads occur when a transaction updates a row, then a second transaction reads that row before the first transaction commits. If the first transaction rolls back the change, the information read by the second transaction becomes invalid. Non-repeatable reads occur when a transaction reads a row then another transaction updates the same row. If the second transaction commits, subsequent reads by the first transaction get different values than the original read. Phantoms occur when a transaction reads a set of rows that satisfy a search condition and then another transaction updates, inserts, or deletes one or more rows that satisfy the first transaction’s search condition. In this case, if the first transaction performs subsequent reads with the same search condition, it reads a different set of rows.
If you use a SET TRANSACTION statement, it must be the first statement in your transaction. NOTE: This command can also be used as a standard SET COMMAND in the config.db file, to set the transaction state on a system or application wide basis.
Keywords | Description |
READ ONLY | Set the default transaction type to read-only. |
READ WRITE | Set the default transaction type to read-write. |
ISOLATION LEVEL | Specify how the transaction will perform. |
SERIALIZABLE | This will disable dirty reads, non-repeatable reads and phantom reads. This is the default isolation level. |
REPEATABLE READ | This will disable dirty reads, non-repeatable reads and enable only phantom reads. |
READ UNCOMMITTED | This will enable dirty reads, non-repeatable reads and phantom reads. |
READ COMMITTED | This will disable dirty reads and enable non-repeatable reads and phantom reads. |
Example
set transaction isolation level read uncommitted
Products
Recital Database Server, Recital Mirage Server, Recital Terminal Developer