如何使对Oracle中存储过程的调用排队? [英] How to queue up calls to stored procedures in Oracle?

查看:145
本文介绍了如何使对Oracle中存储过程的调用排队?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在oracle中有一个存储过程(如果相关,它会安排一次作业来运行另一个过程).该作业将调用另一个运行了几分钟的存储过程,并执行插入更新和删除操作,还使用循环.现在,当长程序正在运行时,如果还有另一个要运行的调用,是否可以防止它们同时执行?甚至更好的是,要使第二个程序在前一个程序完成后执行,例如将它们排队?

I have a stored procedure in oracle (which schedules a one-time job to run another procedure, if this is relevant). The job calls another stored procedure which runs for a few minutes, and performs inserts updates and deletes and also uses loops. Now while the long procedure is running, if there is another call for it to run, is it possible to prevent them from executing simultaneously? And even better, to make the second one execute once the previous one has finished, like queue them?

推荐答案

要防止两个存储过程同时运行,可以使用

To prevent two stored procedures to run at the same time, you could use DBMS_LOCK to get an exclusive lock (or just try to update the same row in a given table).

这篇关于如何使对Oracle中存储过程的调用排队?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆