BEGIN
Starts a transaction block. BEGIN
is a synonym for START TRANSACTION
.
Syntax
BEGIN [ WORK | TRANSACTION ] [ isolation‑level ] [ transaction‑mode]
and where transaction_mode
is one of:
READ { ONLY | WRITE }
Parameters
WORK | TRANSACTION |
Optional keywords for readability purposes only. |
isolation‑level |
Specifies the transaction's isolation level, which determines what data the transaction can access when other transactions are running concurrently. You can set isolation‑level to one of the following:
For detailed information, see Transactions in Vertica Concepts. |
transaction‑mode | |
READ { ONLY | WRITE } |
Transaction mode can be one of the following:
Setting the transaction session mode to read-only disallows the following SQL commands, but does not prevent all disk write operations:
|
Privileges
None
Examples
This example shows how to begin a transaction and set the isolation level.
=> 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)