I am having a procedure that will assign Products against Existing List of Orders.
For rec_ord in(Select Order_ID,Order_Prop1,Order_Prop2,<some more columns>
from Order_Master Where <Some Conditions>)
Loop
<Step-1:Do some Processing on Order_Prop1,Order_Prop2>
[Log the Processing Result]
For rec_prod in (Select Prod_ID,Prod_Prop1,Prod_Prop2,<some more columns>
from Product_Master
Where Prod_Prop1 = Ord_Prop1
and <Some Conditions>)
Loop
<Step-2:Do Some Processing using Prod_Prop2 and Order_Prop2>
[Log the Processing Result]
<Decide Whether to Assign or Not>
[Log the assignment or non-assignment with reason]
End Loop
End Loop
I tried below 2 methods.
- Bulk Collect:I Combined Step-1&2 in the single query by joining Order_Master & Product_Master. And then Using Bulk-Collect to insert the assignment. However I am losing the Logging & Tracking of individual Record.
- For Loop: I used For Loop as given above. But this is taking way too long. Increasing my Execution time by many times.
I want the Processing to be fast along with the logging & tracking. Any Help is appreciated.
Thanx in advance.