Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concurrently execute a loop

Status
Not open for further replies.

DrSmyth

Technical User
Jul 16, 2003
557
0
0
GB
Hi,

I'm new to Oracle, so excuse me if I'm asking an obviuos question.. Basically I have a need to execute a loop concurrently (i.e. execute all of the outcomes of the loop in one go). I can do this easily from unix (just execute as a background process), but am struggling to find a way of doing it in Oracle.

Here's my loop code:
Code:
SELECT DISTINCT CONTEXT_ID into :Tar_ID FROM CONTEXTS WHERE REPORTING_DATE=to_date('#REPORT_DATE#','YYYYMMDD') AND WORKSPACE_ID=2
;

SELECT PK_RD_WS INTO :PK_KEY FROM CONTEXTS WHERE CONTEXT_ID=:Tar_ID;
DELETE FROM T_CDR WHERE PARTITION_KEY=:PK_KEY;

for CONT in ( select context_id from contexts where reporting_date=to_date('#REPORT_DATE#','YYYYMMDD') AND WORKSPACE_ID<>2 )
loop

:Src_ID := CONT.context_id;

   PACK_CONTEXT.CONTEXT_COPY_SET (103,:Tar_Id,:Src_ID);

        end loop;
        commit;
end;

Using the above example, if it found 7 Src_ID, I'd like it to use 7 threads to run the procedure concurrently in one go for each of the loop outcomes.

Thanks.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top