Skip to Main Content
  • Questions
  • How to Use Bulk Collect for Parameterized cursor

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Mayank.

Asked: October 10, 2013 - 1:02 am UTC

Last updated: October 10, 2013 - 6:40 pm UTC

Version: 10.2.1

Viewed 10K+ times! This question is

You Asked

Hi Tom,
I have an API which uses the Staging table which is referes on weekly basis with 20 Million records. It takes 7 hour to process record. I have a question after performing Tuning of the query, I want to use BULK into for performing some scenario. The API is having only 1 Cursor with 5 parameter Passed. How Can I use BULK clause? Is there any other Way to use bulk clause with parameter cursor. After Opening an cursor it take around 1 min for 10 records to process as it check validation for Parent record then child record and then again child records which also includes the Update of same if the respective parent record exists.

Please help me out.

and Tom said...

are you asking for the syntax of a bulk collect?????

http://www.oracle.com/technetwork/issue-archive/2012/12-sep/o52plsql-1709862.html

there are seriously millions of such examples.


if by saying "After Opening an cursor it take around 1 min for 10 records to process as it check validation for Parent record then child record and then again child records which also includes the Update of same if the respective parent record exists."

you mean that your code takes 6 seconds per record - then I'll say that bulk collect will have approximate ZERO affect on your runtime. *zero*. It will not run any faster. You are spending so so SO much time in procedural logic that bulk collecting wont be worth your time.

Look at your algorithm, try to do MORE in SQL. Less in code.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

bulk to use in cursor

Mayank, November 05, 2013 - 3:14 pm UTC

Thanks TOM,
I will try to reduce the code and more fetching in SQl. If I still face the problem I will share the code with You.

Thanks Very much