On Thursday, June 8, 2017, marcinha rocha <marciaestefanidaro...@hotmail.com> wrote:
> On Thursday, June 8, 2017, marcinha rocha <marciaestefanidarocha@ > hotmail.com > <javascript:_e(%7B%7D,'cvml','marciaestefanidaro...@hotmail.com');>> > wrote: > >> On my original select, the row will have migrated = false. Maybe All I >> need to put is a limit 2000 and the query will do the rest? >> >> > You shoud try to avoid the for loop, > > Why? > Mainly expected performance concerns. The engine is designed to handle results sets as opposed to single row iterating. Whether it's true in your case I don't know but I would assume that operating on sets would be faster. > > Ok, cool! > > Now, how do tell the function to return the number of touched rows? On > this case, it should always be 2000. > > Unless there are fewer rows to process. You could always just do i = i + 1 in the loop. David J.