cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Script - Loop through huge table

Former Member
0 Kudos

HI Expert,

I've a HANA table which contains approx. 1 million records. I would like to loop through set of records, perform calculation using PAL function, store the results into table and then proceed with next set of records. Is the DECLARE CURSOR and FOR DO..END FOR only option to Loop through.

Is there any other efficient way of looping through huge data set?

Thanks,

Milind

Accepted Solutions (0)

Answers (1)

Answers (1)

rindia
Active Contributor
0 Kudos

Hi Milind,


Is the DECLARE CURSOR and FOR DO..END FOR only option to Loop through.

You can also use WHILE for looping.


Is there any other efficient way of looping through huge data set?

Generally all of the loop constructs, especially cursors, cause performance issues as SQL engine cannot utilize optimizing the parallelization.

SQLScript reference guide helps you in understanding better, especially page no. 142

Regards

Raj