Start or commit a transaction

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
value = %SSC_COMMIT(dbchannel[, SSQL_TXOFF|SSQL_TXON])

Return value


This function returns SSQL_NORMAL (success) or SSQL_FAILURE (failure). (i)



An internal database channel previously initialized using %SSC_INIT and connected by %SSC_CONNECT. (n)


Commit the transaction for dbchannel. (n)


Start a transaction. If a transaction already exists for dbchannel, commit that transaction first. (n)


%SSC_COMMIT either commits a transaction, starts a new transaction, or both. If it commits a transaction, it hard‑closes any associated cursors.

The default differs from one database to another. SSQL_TXOFF/SSQL_TXON is ignored for databases that don’t support different transaction states.

For databases that support both explicit and implicit transactions (such as SQL Server), %SSC_COMMIT starts an explicit transaction.

For databases that don’t support explicit transactions (such as Oracle), %SSC_COMMIT does not start a transaction. Rather, the first data access (DML) operation (%SSC_OPEN, %SSC_EXECECUTE, %SSC_EXECIO) starts an implicit transaction. In addition, %SSC_COMMIT commits the data to the database, and SSQL_TXON has the same effect as SSQL_TXOFF.

For more information, see Understanding transactions and autocommit.


The following example demonstrates the use of %SSC_COMMIT.

sqlp = "INSERT INTO org1 (deptnum, deptname, manager,"
  &      " division, stdate, budget) VALUES (:1,:2,:3,:4,"
  &      ":5,:6)"
if (%ssc_commit(dbchn, SSQL_TXON))      ;Start the transaction
  goto err_exit 
if (%ssc_open(dbchn, cur2, sqlp, SSQL_NONSEL,
  &             SSQL_STANDARD, 6, deptnum, deptname,
  &             manager, division, stdate, budget))
  goto err_exit
for ix from 1 thru MX_REC   ;Do insert
    call load_data          ;Load data to bind area
                            ;Execute insert statement
    if (%ssc_execute(dbchn, cur2, SSQL_STANDARD))
      goto err_exit
if (%ssc_sclose(dbchn, cur2))
  goto err_exit
if (%ssc_commit(dbchn, SSQL_TXOFF))   ;Commit the change
  goto err_exit