Not waiting for locks
The disadvantage of waiting for locks is that the wait
might become long (although properly designed applications should
hold their locks briefly). When the possibility of a long delay is
not acceptable, a program can execute the following statement:
SET LOCK MODE TO NOT WAIT
When
the program requests a locked row, it immediately receives an error
code (for example, error -107 Record is locked
),
and the current SQL statement terminates. The program must roll back
its current transaction and try again.
The initial setting is not waiting when a program starts up. If you are using SQL interactively and see an error related to locking, set the lock mode to wait. If you are writing a program, consider making that one of the first embedded SQL statements that the program executes.