13. Understanding the Locking System : User-Controlled Locking--SET LOCKMODE : TIMEOUT Value for a Lock Wait
 
Share this page                  
TIMEOUT Value for a Lock Wait
The default for lock time out is 0, which is to wait indefinitely.
For example: User1 is running a report and User2 issues an INSERT statement against the same table. User2’s INSERT appears to hang and waits for a lock on the table until User1’s report completes and the transaction is committed.
If you do not want users to wait indefinitely for locks, TIMEOUT can be set to an integer value expressed in seconds. Then if a lock is not granted in that number of seconds, the statement that is waiting for the lock is aborted and either the single statement or the whole transaction is rolled back depending on the setting of ON ERROR ROLLBACK and an error is returned. This error must be trapped and handled by the application.