select for update [nowait]
The NOWAIT
and WAIT
clauses let you tell the database how to proceed if the SELECT
statement attempts to lock a row that is locked by another user.
-
Specify
NOWAIT
to return control to you immediately if a lock exists. -
Specify
WAIT
to instruct the database to waitinteger
seconds for the row to become available and then return control to you.
If you specify neither WAIT
nor NOWAIT
, then the database waits until the row is available and then returns the results of the SELECT
statement.
解除 lock 的方法:commit or rollback
可能出现的错误:ORA-00054: 资源正忙,但指定已NOWAIT 方式获取资源,或者超时失效