Specifying Transaction Names in a DELETE

From InterBase

Go Up to Deleting 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.

For DELETE, the TRANSACTION clause intervenes between the DELETE keyword and the FROM clause specifying the table from which to delete:

DELETE TRANSACTION name FROM table ...

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

EXEC SQL
DELETE TRANSACTION T1 FROM PART_DEPT
WHERE BUDGET < 1000000;

Advance To: