Cycling through cursor in a procedure