Specifying Transaction Names in UPDATE

From InterBase

Go Up to Updating 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 multiple simultaneous transactions.

In UPDATE, the TRANSACTION clause intervenes between the UPDATE keyword and the name of the table to update, as in the following syntax:

UPDATE [TRANSACTION name] table
SET col = <assignment> [, col = <assignment> ...]
WHERE <search_condition> | WHERE CURRENT OF cursorname;

The TRANSACTION clause must be used in multi-transaction programs, but is optional in single-transaction programs or in programs where only one transaction is open at a time. For example, the following UPDATE is controlled by the transaction, T1:

EXEC SQL
UPDATE TRANSACTION T1 DEPARTMENT
SET BUDGET = 2505700
WHERE DEPARTMENT = 'Publications';

Advance To: