Syntax
OB_TRANSACTION_ID()
Purpose
- If the current session is in an active transaction, this function returns the integer value of the transaction ID, which is greater than 0.
- If the current session is not in an active transaction, this function returns 0.
Examples
Start a transaction.
obclient [SYS]> START TRANSACTION;Query the ID of the transaction that is active.
obclient [SYS]> SELECT OB_TRANSACTION_ID() FROM DUAL;The result is as follows:
+---------------------+ | OB_TRANSACTION_ID() | +---------------------+ | 11003721 | +---------------------+ 1 row in setCommit the transaction.
obclient [SYS]> COMMIT;Query the ID of the transaction that is not active.
obclient [SYS]> SELECT OB_TRANSACTION_ID() FROM DUAL;The result is as follows:
+---------------------+ | OB_TRANSACTION_ID() | +---------------------+ | 0 | +---------------------+ 1 row in set