Sets the characteristics of the current transaction.
Syntax
SET TRANSACTION transaction_mode
Transaction_mode
can be one of the following options:
ISOLATION LEVEL { SERIALIZABLE | READ COMMITTED }
READ WRITE | READ ONLY
Description
The SET TRANSACTION
command sets the characteristics of the current transaction. This command has no
effect on subsequent transactions. The available transaction characteristics are the
transaction isolation level and the transaction access mode (read/write or read-only).
The isolation level of a transaction determines what data the transaction can read
when other transactions are running concurrently.
READ COMMITTED
A statement can read only rows that are committed before the statement starts. This is the default value.
SERIALIZABLE
All statements of the current transaction can read only rows that are committed before the first query or before data modification statement is executed in this transaction.
After the first query or data modification statement (SELECT
, INSERT
, DELETE
, UPDATE
, or FETCH
) is executed, the transaction isolation level cannot be changed. The transaction
access mode determines whether the transaction is read/write or read-only. The default
value is read/write.
A read-only transaction does not support the following SQL commands: CREATE
, ALTER
, DROP
, COMMENT
, GRANT
, REVOKE
, and TRUNCATE
. The read-only transaction does not support the INSERT
, UPDATE
, and DELETE
commands if the table to which these commands write is not a temporary table. The
read-only transaction does not support the EXECUTE
command if one of the listed commands is executed within the transaction. This is
an advanced read-only mode that does not block all write operations on a disk.