我们可以在 PL/SQL 中使用线程吗?

Can We use threading in PL/SQL?(我们可以在 PL/SQL 中使用线程吗?)
本文介绍了我们可以在 PL/SQL 中使用线程吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 中使用线程吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

SQL to Generate Periodic Snapshots from Transactions Table(用于从事务表生成定期快照的SQL)
MyBatis support for multiple databases(MyBatis支持多个数据库)
Oracle 12c SQL: Missing column Headers in result(Oracle 12c SQL:结果中缺少列标题)
SQL query to find the number of customers who shopped for 3 consecutive days in month of January 2020(查询2020年1月连续购物3天的客户数量)
How to get top 10 data weekly (This week, Previous week, Last month, 2 months ago, 3 month ago)(如何每周获取前十大数据(本周、前一周、上个月、2个月前、3个月前))
Select the latest record for an Id per day - Oracle pl sql(选择每天ID的最新记录-Oracle pl SQL)