如何在 plsql 中为匿名块或查询设置超时? [英] How to set timeout for anonoymous block or query in plsql?

查看:59
本文介绍了如何在 plsql 中为匿名块或查询设置超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道您可以设置用户个人资料或设置查询的一般超时.>

但我希望为过程中的特定查询设置超时并捕获异常,例如:

开始更新 tbl 设置 col = v_val;--无限时间从 id = 20 的 tbl 中删除;--无限时间开始从 tbl 中删除;-- 我希望这有一个有限的时间来执行异常(超时???)然后- 代码;结尾;结尾;

这可能吗?我能捕捉到任何超时异常吗?每个块或查询?没有找到关于该主题的太多信息.

解决方案

不,您不能在 pl/sql 中设置超时.您可以为此使用宿主语言,在其中嵌入 sql 和 pl/sql.

I know you can set user profiles or set a general timeout for query.

But I wish to set timeout to a specific query inside a procedure and catch the exception, something like :

begin
      update tbl set col = v_val; --Unlimited time
      delete from tbl where id = 20; --Unlimited time

      begin
            delete from tbl; -- I want this to have a limited time to perform
            exception  when (timeout???) then
            --code; 

      end;

end;

Is this possible? is there any timeout exceptions at all I can catch? per block or query? didn't find much info on the topic.

解决方案

No, you can not set a timeout in pl/sql. You could use a host language for this in which you embed your sql and pl/sql.

这篇关于如何在 plsql 中为匿名块或查询设置超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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