Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can We use threading in PL/SQL?

Tags:

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; 

In the above case, I don't want my code to wait for myProc(1,100) to finish processing before executing(101,200)
Thanks.

like image 894
Burhan Avatar asked Feb 23 '09 07:02

Burhan


People also ask

Is Oracle DB multithreaded?

In contrast, the Oracle database runs as a single multithreaded process on Windows, with each of the UNIX/Linux processes running on one or more threads. Oracle 12c includes the ability to run the database on UNIX/Linux environments with a multithreaded model, similar to how it runs under Windows.

What is multithreading Oracle?

In a multithreaded process on a single processor, the processor can switch execution resources between threads, resulting in concurrent execution.

Is Oracle single threaded?

Although Java in Oracle Database allows running threaded programs, it is single-threaded at the execution level.

What are the 3 types of PL SQL statements?

PL/SQL has three categories of control statements: conditional selection statements, loop statements and sequential control statements.


1 Answers

+1 for DBMS_SCHEDULER and DBMS_JOB approaches, but also consider whether you ought to be using a different approach.

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.

like image 66
David Aldridge Avatar answered Sep 20 '22 13:09

David Aldridge