ALLBASE/SQL Reference Manual (36216-90216)

312 Chapter10
SQL Statements A - D
BEGIN WORK
BEGIN WORK
The BEGIN WORK statement begins a transaction and, optionally, sets one or more
transaction attributes.
Scope
ISQL, Application Programs, or Procedures
SQL Syntax
BEGIN WORK [
Priority
][RR
CS
RC
RU ][LABEL {
‘LabelString’
:
HostVariable
}][[PARALLEL
NO ]FILL]
Parameters
Priority
is an integer from 0 to 255 specifying the priority of the transaction.
Priority 127 is assigned if you do not specify a priority. ALLBASE/SQL
uses the priority to resolve a deadlock. The transaction with the largest
priority number is aborted to remove the deadlock.
For example, if a priority-0 transaction and a priority-1 transaction are
deadlocked, the priority-1 transaction is aborted. If two transactions
involved in a deadlock have the same priority, the deadlock is resolved by
aborting the newer transaction (the last transaction begun, either
implicitly or with a BEGIN WORK statement).
RR Repeatable Read. Means that the transaction uses locking strategies to
guarantee repeatable reads.
RR is the default isolation level.
CS Cursor Stability. Means that your transaction uses locking strategies to
assure cursor-level stability only.
RC Read Committed. Means that your transaction uses locking strategies to
ensure that you retrieve only rows that have been committed by some
transaction.
RU Read Uncommitted. Means that the transaction can read uncommitted
changes from other transactions. Reading data with RU does not place any
locks on the table being read.
LabelString
is a user defined character string of up to 8 characters. The default is a
blank string.
The label is visible in the SYSTEM.TRANSACTION pseudo-table and also
in SQLMON. Transaction labels can be useful for troubleshooting and
performance tuning. Each transaction in an application program can be