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 方式获取资源,或者超时失效
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步