Skip to main content

START TRANSACTION (bSQL) | Blockpoint Docs

Marks the starting point of an explicit, local transaction. Explicit transactions start with the START TRANSACTION statement and end with the COMMIT or ROLLBACK statement.

Syntax​

START TRANSACTION

General Remarks​

  • START TRANSACTION increments the transaction count by 1.

  • START TRANSACTION represents a point at which the data referenced by a connection is logically and physically consistent. If errors are encountered, all data modifications made after the START TRANSACTION can be rolled back to return the data to this known state of consistency. Each transaction lasts until either it completes without errors and COMMIT is issued to make the modifications a permanent part of the database, or errors are encountered and all modifications are erased with a ROLLBACK statement.

  • When AUTO COMMIT is set to TRUE, a START TRANSACTION statement commits after every command. For more information see, AUTOCOMMIT.

Examples​

A. Using an explicit transaction.​

By setting AUTOCOMMIT to false, we don't commit any mutations until the COMMIT command is called.

This example uses the Financial Demo Database.

START TRANSACTION
SET AUTOCOMMIT = 0
INSERT financial.companies 
VALUES ("WPG", "Washington Prime Group", "Trust")
COMMIT 

B. Rolling back a transaction.​

The following example shows the effect of rolling back a transaction. In this example, the ROLLBACK statement will roll back the INSERT statement.

START TRANSACTION
SET AUTOCOMMIT = 0
INSERT financial.companies 
VALUES ("WPG", "Washington Prime Group", "Trust")
ROLLBACK

See Also​