All Forums Database
Piotr_Skrzypiec 11 posts Joined 09/13
21 May 2014
stored procedures with loop - queueing

Hi,
Due to size of data (not to blow spool space) I need to chop that big dataset with cursor looping through X millions of rows.
Our database is really busy, and each iteration of loop gets parsed individually. This results in stored procedure executing hours, simply due to sql statement executed in loop getting queued with each time loop iterates.
Is there any way of executing stored procedure in the way that it would avoid queuing looped sql statement ?
Sounds silly, but I am desparate.
 
Regards,
Piotr

Raja_KT 1246 posts Joined 07/09
21 May 2014

Will the below link of this gentleman help you? It is self-explanatory.
http://developer.teradata.com/blog/georgecoleman/2011/05/using-derived-tables-as-a-shortcut-to-set-sql
http://developer.teradata.com/blog/georgecoleman/2012/03/derived-tables-with-ordered-analytical-functions-to-translate-flat-logic
 
 

Raja K Thaw
My wiki: http://en.wikipedia.org/wiki/User:Kt_raj1
Street Children suffer not by their fault. We can help them if we want.

You must sign in to leave a comment.