create procedure testProc () BEGIN declare loopCounter INT; declare loopCounterMax INT declare startCounter INT; declare EndCounter INT; SET loopCounter = 100; SET loopCounterMax = 1000001; SET StartCounter = 0; SET EndCounter = 1; label1: WHILE EndCounter < loopCounterMax DO SET EndCounter = EndCounter + startCounter; SET @s = concat( 'insert into testsch.customerevents_01 select a.* from testsch.customerevents a where exists (select 1 from testsch.custeventTID_01 b where a.TID = b.TID and b.sql_row_id > ',startCounter' and b.sql_row_id < ',EndCounter ' ) '); PREPARE stmt from @s; EXECUTE stmt; DEALLOCATE PREPARE stmt; SET startCounter = EndCounter -1; END WHILE label1; END;
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.