Setting the lock mode to wait

When an application process encounters a lock, the default behavior of the database server is to return an error. Instead, you can run an SQL statement to set the lock mode to wait. This specifies that an application process does not proceed until the lock is removed.

About this task

To suspend the current process until the lock releases, run the following SQL statement :
SET LOCK MODE TO WAIT; 
You can also specify the maximum number of seconds that a process waits for a lock to be released before issuing an error. In the following example, the database server waits for 20 seconds before issuing an error:
SET LOCK MODE TO WAIT 20;
To return to the default behavior (no waiting for locks), execute the following statement:
SET LOCK MODE TO NOT WAIT;