Transactions

SQL SET TRANSACTION

Configure isolation or read/write behaviour within supported transaction contexts.

Availability: Common SQL with references for SQL standard, MySQL/MariaDB, PostgreSQL, SQL Server, SQLite and Oracle Database; syntax and feature support vary by engine and version.中文

Syntax

SET TRANSACTION ISOLATION LEVEL ...;

Examples

Configure isolation or read/write behaviour within supported transaction contexts.

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SQLite-oriented example; consult the relevant dialect manual.

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

Parameters, options and clauses

Option / clauseDescription
BEGIN / START TRANSACTIONStart a transaction; exact keywords vary by engine.
COMMITMake the transaction's changes permanent.
ROLLBACKUndo uncommitted work or return to a savepoint.
SAVEPOINTMark an intermediate point within a transaction.
Isolation levelChoose concurrency behaviour where supported.

Dialect references

Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory