Block procedure PL/SQL with Oracle

倾然丶 夕夏残阳落幕 提交于 2019-12-19 17:32:05

问题


I have a procedure and I would like that only one user could execute this procedure at same time.


回答1:


This is just off the top of my head: Consider using a named lock via dbms_lock. http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_lock.htm#CHDICHDC

Right after the begin statement get the lock, do the work, then release it on exit (Keep errors/exceptions in mind!).

KT




回答2:


A simple solution can be to use lock at the table level, by using FOR UPDATE.



来源:https://stackoverflow.com/questions/1053484/block-procedure-pl-sql-with-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!