Example of Cursor in Mysql
DELIMITER //
CREATE PROCEDURE
myone()
BEGIN
declare
myno int(3);
DECLARE done INT
DEFAULT FALSE;
declare
mycursor CURSOR for select roll_no from
fine;
DECLARE
CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
open
mycursor;
Label1 : LOOP
fetch
mycursor into myno;
if done=TRUE then
leave Label1;
end if;
select myno;
leave Label1;
end if;
select myno;
END LOOP;
close mycursor;
END //