set transaction

Set transaction operational mode

Syntax

set_transaction:
          SET TRANSACTION READ {ONLY | WRITE} [ISOLATION LEVEL iso_level]
     |    SET TRANSACTION AUTOCOMMIT [TO | =] {ON | OFF}

Description

The SET TRANSACTION statement is used to set the default transaction mode and to turn on or off the autocommit transaction mode.

Two default transaction modes are supported: READ ONLY mode and WRITE. The default transaction mode indicates the kind of transaction that will be initiated by execution of the START TRANSACTION statement that does not specify a mode. The initial default transaction mode is WRITE.

The ISOLATION LEVEL clause is provided for future use and to conform to the SQL standard. Note, however, that currently only SERIALIZABLE is supported regardless of which isolation level is specified.

The AUTOCOMMIT clause can be used to turn on or off autocommit mode. When autocommit is on, each INSERT, UPDATE, and DELETE statement will automatically issue a transaction commit at the end of the statement unless a transaction was explicitly started by the application prior to the statement’s execution.

Example

set transaction read;
start transaction;
...  – insert, update, delete statements are not allowed
commit;

See Also

START TRANSACTION