0

I have a procedure like this.

create or replace
Procedure PROCEDURE_NAME
begin

Insert Instructions

Insert Instructions

Insert Instructions

Some Instructions

Some Instructions

Some Instructions


end;

The above shall be instruction blocks which can be executed parallel without having any sort of conflicts. How can I define in Oracle Procedure to execute them in parallel ?

I can make different procedures for them but looking for minimum modification in this procedure, I believe to call instruction parallel in SQL is possible.

1
  • Why all CAPS in question title? Commented May 7, 2013 at 9:19

2 Answers 2

5

Executing multiple procedures in parallel can be done through DBMS_Scheduler chains. These allow a series of procedures to be executed based on success or failure of other procedures.

Oracle's SQL Developer has a graphical interface to help with it, although I've always coded them by hand myself.

There's a useful example in the documentation.

Sign up to request clarification or add additional context in comments.

1 Comment

Again, I am not asking you how to run multiple procedures in parallel but how to run multiple statements within a procedure as parallel.
1

You definitely should read Oracle Docs about parallel execution

But summarising, for a beginner:

You can specify a statement to be run in parallel(with a hint):

select /*+parallel(e 4)*/ *
from emp e;

You can set a table to be read in parallel:

ALTER TABLE emp PARALLEL 4;
--a select on it will run in parallel;

A function can be run in parallel if issued by a parallel query, adding PARALLEL_ENABLE after the returning clause when you define it.

A procedure can't be secified to be run in parallel, AFAIK(and it does not make much sense for me).

3 Comments

I need 2 statements to run in parallel. I think you should read it again now.
ouch, my answer is useless for your requirement, but I'll leave it here, maybe is useful for someone...
I think I understood it. PL/SQL does not have a native ability to run statements in parallel. Encapsulating the statements in a DBMS_Scheduler job is the most robust way of doing it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.