Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to avoid nested loops(if the inner loop also multiple records)

Former Member
0 Likes
953

Hi Friends,

I am using loop inside loop giving timing out so in this case how i will avoid loop inside loop since the inner loop also having so many records. I heard that some parallel cursor concept but i dont know about that .

Can you please suggest how to avoind nested loop with some example

Points will be award and your answers are highly appreciable

Thanks & Regards,

Govind

1 ACCEPTED SOLUTION
Read only

Former Member

Hi Friends,

I am using loop inside loop giving timing out so in this case how i will avoid loop inside loop since the inner loop also having so many records. I heard that some parallel cursor concept but i dont know about that .

Can you please suggest how to avoind nested loop with some example

Points will be award and your answers are highly appreciable

Thanks & Regards,

Govind

5 REPLIES 5
Read only

Former Member
Read only

Former Member
0 Likes
778

Hi Govinda,

Please see the already posted thread

.

Thanks

Sekhar.

Read only

christian_wohlfahrt
Active Contributor
0 Likes
778

Hi Govind!

There is also a nice weblog <a href="/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops">'Performance of Nested Loops'</a> with coding example from Rob. Have a look. The nested loop itself isn't the problem, you just should use binary search or an internal table of type 'sorted'.

Regards,

Christian

Read only

Former Member
0 Likes
778

Instead of using loop inside loop,

use loop and read statement.

if both the tables have some common key then use the keyoption else use the index and increment the index after readind.

count = 0.

loop at ITAB1.

read table ITAB2 with key or

read table ITAB2 INDEX count.

count = count + 1.

endloop.

Read only

Former Member
0 Likes
778

Hi all,

I solved my problem and awarded the points also

Regards,

Govind