如何使用 PL/SQL 而不使用 Oracle 队列编写队列基础代码
我想编写队列基本代码来处理多线程应用程序的分配线程和进程。我不想使用 Oracle 提供的队列。我有一个表,其中按应用程序的符号排列行。我想编写通用进程来读取该表并通过分配为线程来处理一行。我还想知道如何出队和入队。
任何帮助将不胜感激。
I would like to write queue base code to process assign thread and process for multi threaded application. I don't want to use Oracle provided queue. I have table where it has rows by application's symbol. I would want to write generic process to read this table and process one row by assigning as thread. I would also like to know how to dequeue and enqueue.
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了有效地完成此操作而不引入序列化问题,您需要使用 Oracle 11g,它在
SELECT FOR UPDATE
语句中引入了SKIP LOCKED
子句。然而,正如 Vincent Malgrat 提到的,你正在重新发明轮子 - 这不是一个好主意。
To do it effectively without introducing serialization issues, you'd need to be on Oracle 11g, which introduced the
SKIP LOCKED
clause to theSELECT FOR UPDATE
statement.However, as Vincent Malgrat mentioned, you're reinventing the wheel - and that's just not a good idea.