Commit or Rollback Transaction using Dynamic SQL

Unsupported feature

Transactions that are dynamically committed are unsupported.

SQLs that are dynamically committed or rolled back are unsupported.

Example 1:

execute immediate "commit";
string ls_sql
ls_sql = "Rollback"
Execute immediate :ls_sql;

Workaround

Call the Commit or Rollback SQL statement directly. For example,

Commit {USING TransactionObject};
Rollback {USING TransactionObject};

Example 2:

ls_exec = 'SAVE TRANSACTION ' + as_savepointname
execute immediate :ls_exec using sqlca;
//NOTE this is a rollback of a savepoint, not a rollback of the entire transaction:
ls_exec = 'ROLLBACK TRANSACTION ' + as_savepointname
execute immediate :ls_exec using sqlca;

Workaround

Move the related business logic to the procedure and implement the transaction savepoint in the procedure.