January 2012 8.12 Tables 1627
SQL COMMIT The NC block SQL COMMIT cancels locks on table rows or table columns.
Edited table data are permanently transferred through SQL COMMIT.
The specified Q parameter is assigned a return code. If the command has
been completed successfully, the Q parameter is assigned a zero. If not, it is
assigned a one.
Definition
sql-commit := SQL COMMIT q-parameter sql-handle
Example:
SQL COMMIT Q80 HANDLE Q5
SQL ROLLBACK The NC block SQL ROLLBACK undoes a transaction. In particular, the lock on
rows in an SQL statement "SELECT ... FOR UPDATE" is canceled.
The specified Q parameter is assigned a return code. If the command has
been completed successfully, the Q parameter is assigned a zero. If not, it is
assigned a one.
If required, you can specify in the index the row for which the transaction is to
take effect.
Definition
sql-rollback := SQL ROLLBACK q-parameter sql-handle [ sql-index ]
Example:
SQL ROLLBACK Q80 HANDLE Q5
Command options
for SELECT and
UPDATE
Command options allow you to define conditions, sorting sequences and locks
that modify the effect of a command.
WHERE The WHERE option limits the effect of a command to the rows of a table
which satisfy the specified condition.
Definition
where-option:= WHERE condition
ORDER BY The ORDER BY option influences the sequence of rows in the result set. At
present, it is only possible to sort by column (default ASC).
Definition
order-option:= ORDER BY column [ ASC | DESC ]
FOR UPDATE The FOR UPDATE option already locks the rows during selection (pessimistic
locking).
Without the FOR UPDATE option, the selected rows are not locked until the
COMMIT command is executed (optimistic locking).
Definition
update-option:= FOR UPDATE