问题描述
PL/SQL 中有异步调用的特性吗?假设我在一个代码块中想要多次调用一个过程并且不会打扰过程返回的时间和内容?
Is there any feature of asynchronous calling in PL/SQL? Suppose I am in a block of code would like to call a procedure multiple times and wouldn't bother when and what the procedure returns?
BEGIN
myProc(1,100);
myProc(101,200);
myProc(201,300);
...
...
END;
在上述情况下,我不希望我的代码在执行(101,200)之前等待 myProc(1,100) 完成处理
谢谢.
In the above case, I don't want my code to wait for myProc(1,100) to finish processing before executing(101,200)
Thanks.
推荐答案
+1 用于 DBMS_SCHEDULER 和 DBMS_JOB 方法,但也要考虑您是否应该使用不同的方法.
+1 for DBMS_SCHEDULER and DBMS_JOB approaches, but also consider whether you ought to be using a different approach.
如果您有一个以逐行方式执行的过程并且您发现它很慢,那么答案可能不是同时多次运行该过程而是确保使用基于集合的方法.在极端情况下,您甚至可以使用并行查询和并行 DML 来减少进程的挂钟时间.
If you have a procedure which executes in a row-by-row manner and you find that it is slow, the answer is probably not to run the procedure multiple times simltaneously but to ensure that a set-based aproach is used instead. At an extreme you can even then use parallel query and parallel DML to reduce the wall clock time of the process.
我提到这个只是因为这是一个很常见的错误.
I mention this only because it is a very common fault.
这篇关于我们可以在 PL/SQL 中使用线程吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!