Specifying Transaction Names in an INSERT

From InterBase

Go Up to Inserting Data (Embedded SQL Guide)


InterBase enables a SQL application to run simultaneous transactions if:

  • Each transaction is first named with a SET TRANSACTION statement. For a complete discussion of transaction handling and naming, see Working with Transactions.
  • Each data manipulation statement (SELECT, INSERT, UPDATE, DELETE, DECLARE, OPEN, FETCH, and CLOSE) specifies a ­TRANSACTION clause that identifies the name of the transaction under which it operates.
  • SQL statements are not dynamic (DSQL). DSQL does not support user-specified transaction names.

With INSERT, the TRANSACTION clause intervenes between the INSERT keyword and the list of columns to insert, as in the following syntax fragment:

INSERT TRANSACTION name INTO table (col [, col ...])

The TRANSACTION clause is optional in single-transaction programs. It must be used in a multi-transaction program unless a statement operates under control of the default transaction, GDS__TRANS. For example, the following INSERT is controlled by the transaction, T1:

EXEC SQL
INSERT TRANSACTION T1 INTO DEPARTMENT (DEPARTMENT, DEPT_NO, BUDGET)
VALUES (:deptname, :deptno, :budget INDICATOR :bi);

Advance To: