Block procedure PL/SQL with Oracle

前端 未结 2 1911
死守一世寂寞
死守一世寂寞 2021-01-18 03:14

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

相关标签:
2条回答
  • 2021-01-18 03:51

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

    0 讨论(0)
  • 2021-01-18 04:11

    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

    0 讨论(0)
提交回复
热议问题