SET TRANSACTION
Description
Sets the transaction isolation level.
seekdb supports the Read Committed and Repeatable Read isolation levels. The default isolation level is Read Committed.
-
You cannot set the isolation level during a transaction. Otherwise, an error will be returned.
ERROR:OBE-01453: SET TRANSACTION must be first statement of transaction -
When you enable the Serializable isolation level, you must ensure that the Global Timestamp Service (GTS) is enabled.
-
The session must maintain the transaction isolation level at the session level. When a transaction is started, the session-level transaction isolation level is obtained. This isolation level can be overridden by the transaction-level isolation level.
Syntax
SET [GLOBAL | SESSION | LOCAL] TRANSACTION trans_opt;
trans_opt:
transaction_access_mode
| isolation_level
| transaction_access_mode, isolation_level
| isolation_level, transaction_access_mode
transaction_access_mode:
[READ ONLY | READ WRITE]
isolation_level:
ISOLATION LEVEL {
READ UNCOMMITED
| READ COMMITED
| REPEATABLE READ
| SERIALIZABLE
}
Parameters
| Parameter | Description |
|---|---|
| GLOBAL | SESSION | LOCAL | The scope of the transaction isolation level. Default value: empty.
|
| READ ONLY | READ WRITE | Specifies the read/write mode of the transaction. |
| READ UNCOMMITED | Specifies the transaction isolation level as Read Uncommitted. Note This version does not support setting the transaction isolation level to Read Uncommitted. |
| READ COMMITED | Specifies the transaction isolation level as Read Committed. |
| REPEATABLE READ | Specifies the transaction isolation level as Repeatable Read. |
| SERIALIZABLE | Specifies the transaction isolation level as Serializable. |
Examples
-
Set the transaction isolation level of the next transaction in the current session to Read Committed.
SET TRANSACTION ISOLATION LEVEL READ COMMITTED; -
Set the transaction isolation level of the current session to Repeatable Read.
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;