TXNLEVEL()
From Recital Documentation Wiki
Revision as of 15:37, 22 December 2009 by Yvonnemilne (Talk | contribs)
Purpose
Function to return the current Transaction Level number
Syntax
TXNLEVEL()
See Also
BEGIN TRANSACTION, COMMIT, COMPLETED(), END TRANSACTION, RESET IN, ROLLBACK, ROLLBACK(), SET ROLLBACK, SET TRANSACTION, TXNISOLATION()
Description
The TXNLEVEL() function returns the current Transaction level as a number. Transactions can be nested by issuing a further BEGIN TRANSACTION when a transaction is already active. If no transaction is active, the TXNLEVEL() function returns 0. A transaction and any transactions nested within it are closed when a COMMIT, ROLLBACK or END TRANSACTION is issued.
Example
// Nested Transactions ? txnlevel() && 0 BEGIN TRANSACTION trans1 ? txnlevel() && 1 INSERT INTO customer; (TITLE, LAST_NAME, FIRST_NAME, INITIAL, STREET,; CITY, STATE, ZIP,LIMIT, START_DATE); VALUES; ('Ms', 'Jones', 'Susan', 'B', '177 High Street','Beverly', 'MA', '01915', 2000, date()) INSERT INTO accounts (ORD_VALUE) VALUES (30) BEGIN TRANSACTION trans2 ? txnlevel() && 2 INSERT INTO accounts (ORD_VALUE) VALUES (60) // Commit the trans1 transaction and any transactions // nested in trans1 COMMIT TRANSACTION trans1 ? txnlevel() && 0 END TRANSACTION ? txnlevel() && 0
Products
Recital, Recital Server