BEGIN
Starts a transaction block.
	Starts a transaction block.
Note
BEGIN is a synonym for START TRANSACTION.Syntax
BEGIN [ WORK | TRANSACTION ] [ isolation-level ] [ READ [ONLY] | WRITE ]
Parameters
- WORK | TRANSACTION
- Optional keywords for readability only.
- isolation-level
- Specifies the transaction's isolation level, which determines what data the transaction can access when other transactions are running concurrently, one of the following:
- 
READ COMMITTED (default) 
- 
REPEATABLE READ (automatically converted to SERIALIZABLE) 
- 
READ UNCOMMITTED (automatically converted to READ COMMITTED) 
 For details, see Transactions. 
- 
- READ [ONLY] | WRITE
- Specifies the transaction mode, one of the following:
- 
READ WRITE (default): Transaction is read/write. 
- 
READ ONLY: Transaction is read-only. 
 Setting the transaction session mode to read-only disallows the following SQL statements, but does not prevent all disk write operations: - 
INSERT, UPDATE, DELETE, and COPY if the target table is not a temporary table 
- 
All CREATE, ALTER, and DROP commands 
- 
GRANT, REVOKE, and EXPLAIN if the SQL to run is one of the statements cited above. 
 
- 
Privileges
None
Examples
Create a transaction with the isolation level set to READ COMMITTED and the transaction mode to READ WRITE:
=> BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED READ WRITE;
BEGIN
=> CREATE TABLE sample_table (a INT);
CREATE TABLE
=> INSERT INTO sample_table (a) VALUES (1);
OUTPUT
--------
1
(1 row)
=> END;
COMMIT