Originally posted by arun_rashmi
select count(*) into x from testtable;
You *gotta* be kidding

Stick with Kmesser's solution!

Although I'd add that you should look into bulk processing (FORALL) which will really save you time in the loop.

- Chris