SQL/MX Comparison Guide for SQL/MP Users

DML Features
HP NonStop SQL/MX Comparison Guide for SQL/MP Users523735-003
3-18
Transaction Management
STABLE Access and EXCLUSIVE MODE
In both NonStop SQL/MX and NonStop SQL/MP, if you use STABLE access with
EXCLUSIVE MODE, you do not get an error, because the next transaction must wait
for access to the row.
Transaction Management
A TMF transaction is the basic recoverable unit in case of a failure or transaction
interruption. TMF transactions can be defined during an MXCI session or in a host
program. The typical order of events is:
1. Transaction is started.
2. Database changes are made.
3. Transaction is committed.
If the changes cannot be made or you do not want to complete the transaction, your
program can abort the transaction so the database is rolled back to its original state.
Starting and Ending a Transaction
In NonStop SQL/MX and NonStop SQL/MP, to ensure that a sequence of statements
either executes successfully or not at all, define one transaction consisting of these
statements by using the BEGIN WORK and COMMIT WORK statements. You can
abort a transaction with the ROLLBACK WORK statement. BEGIN WORK is an
extension to the ANSI standard.
User-Defined or Explicit Transactions
Transactions you do not start through SQL, such as TMF, MXCS, or inherited
transactions, are called user-defined, or explicit, transactions. You must commit or roll
back these transactions.
If an error occurs in an explicit transaction for an INSERT, UPDATE, or DELETE
statement on audited tables, the transaction is not aborted automatically. However,
your data can be in an inconsistent state within a query.
System-Defined or Implicit Transactions
NonStop SQL/MP has implicit transactions in SQLCI but not in embedded statements.
NonStop SQL/MX also has implicit transactions. It initiates a transaction when it
encounters an SQL statement if a BEGIN WORK statement has not been specified
and if the statement references an audited table. Most DML statements initiate
transactions implicitly at the start of execution. NonStop SQL/MX does not initiate a
transaction for a SELECT statement with READ UNCOMMITTED access.