在插入预言之后延迟触发器调用
有办法做到这一点吗?我发现
DBMS_LOCK.sleep()
通过谷歌搜索将, 添加到触发代码的开头,但它阻止了插入本身的发生。我想插入数据,但触发器只能在任意延迟后触发。谢谢。
Is there a way to do this?. I found adding,
DBMS_LOCK.sleep()
to the beginning of the trigger code by googling, but it blocks the insert itself from happening. I would like to insert the data but the trigger should be fired only after an arbitrary delay. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我们知道为什么您想要这种延迟,以及触发器在延迟后应该执行什么操作,将会有所帮助。但是,一种可能性是使用 DBMS_JOB打包在触发器中以创建一个在插入后不久运行的作业。例如:
或者,触发器可以将一行插入到特殊表中,并且按计划(例如每 10 分钟运行一次)的 DBMS_JOB 可以处理表中超过 X 分钟的行。
It would help if we knew why you want this delay, and what the trigger is supposed to do after the delay. However, one possibility is to use the DBMS_JOB package in the trigger to create a job that runs at a time a little after the insert. For example:
Alternatively, the trigger could insert a row into a special table, and a DBMS_JOB that runs on a schedule e.g. every 10 minutes could process rows in the table that are more than X minutes old.