2.30 SET TRANSACTION ISOLATION
Description
Explicitly sets the isolation level for a transaction. Isolation levels specify the degree to which one transaction can modify data or database objects being used by another concurrent transaction.
Syntax
SET TRANSACTION ISOLATION LEVEL isolation_level ;isolation_level ::READ UNCOMMITTED| READ COMMITTED| REPEATABLE READ| SERIALIZABLEArguments
READ UNCOMMITTED
Allows dirty reads, non-repeatable reads, and phantoms (described below in Notes).READ COMMITTED
Prohibits dirty reads; allows non-repeatable reads and phantoms.REPEATABLE READ
Prohibits dirty reads and non-repeatable reads; allows phantoms.SERIALIZABLE
The default. Prohibits dirty reads, non-repeatable reads, and phantoms (see Table 2-1: Permitted Inconsistencies in Transactions on page 2-50). It guarantees that concurrent transactions will not affect each other, that they behave as if they were executing serially, not concurrently.Notes
SET TRANSACTION allows the user to choose the isolation level for future transactions. If a transaction is currently active, SET TRANSACTION generates an error.
The isolation level specifies the degree to which one transaction is isolated from the effects of concurrent access of the database by other transactions. The appropriate level of isolation depends on how a transaction needs to be isolated from effects of another transaction. Higher isolation levels provide greater data consistency to the user's transaction but reduce access to data by concurrent transactions.
The isolation level SERIALIZABLE guarantees the highest consistency and is the default. The isolation level READ UNCOMMITTED guarantees the least consistency. The ANSI/ISO SQL standard defines isolation levels in terms of the of the inconsistencies they allow, as detailed next:
Authorization
None.
SQL Compliance SQL-92. Environment Embedded SQL and interactive Related Statements LOCK TABLE, COMMIT, ROLLBACK
|
FairCom Corporation www.faircom.com |