Allows you to control the SQL behavior for starting a default transaction for a compound statement. By default, if there is no current transaction, SQL starts a transaction before executing a compound statement or stored procedure. However, this might conflict with the actions within the procedure, or it might start a transaction for no reason if the procedure body does not perform any database access. This default is retained for backward compatibility for applications which may expect a transaction to be started for the procedure.
1 – Environment
You can use the SET COMPOUND TRANSACTIONS statement: o In interactive SQL o In dynamic SQL as a statement to be dynamically executed
2 – Format
(B)0[m[1;4mSET[m[1m [1;4mCOMPOUND[m[1m [1;4mTRANSACTION[m[1m qqq> int-ext-val[m
3 – Arguments
3.1 – int-ext-value
A string literal or host variable containing the keyword 'INTERNAL' or 'EXTERNAL'. These keywords can be in any case (uppercase, lowercase, or mixed case). If the value is set to EXTERNAL, then SQL starts a transaction before executing the procedure. If the value is set to INTERNAL, then SQL allows the procedure to start a transaction as required by the procedure execution.
4 – Example
Example 1: Enabling and Disabling Transaction Starting In interactive or dynamic SQL, the following SET command can be used to disable or enable transactions starting by the SQL interface. The parameter to the SET command is a string literal or host variable containing the keyword 'INTERNAL' or 'EXTERNAL'. SQL> SET COMPOUND TRANSACTIONS 'internal'; SQL> CALL START_TXN_AND_COMMIT (); SQL> SET COMPOUND TRANSACTIONS 'external'; SQL> CALL UPDATE_EMPLOYEES (...);