DROP TABLE IF EXISTS test_table1;
CREATE TABLE test_table1 (test_int INT);
INSERT INTO test_table1 values(10);

DROP PROCEDURE IF EXISTS testCursor;

DELIMITER //
CREATE PROCEDURE testCursor()

BEGIN

 DECLARE test_int INT;
 DECLARE done INT DEFAULT FALSE;
-- FAILS WITH THIS CURSOR
 DECLARE testCursor CURSOR
 FOR
 SELECT test_int FROM test_table1;
 DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;

 OPEN testCursor;

  read_loop: LOOP
    FETCH testCursor INTO test_int;
    IF done THEN
      LEAVE read_loop;
    END IF;
    SELECT test_int;
  END LOOP;

 CLOSE testCursor;
--

END //
DELIMITER ;

DROP PROCEDURE IF EXISTS testNoCursor;

DELIMITER //
CREATE PROCEDURE testNoCursor()
BEGIN
 SELECT * FROM test_table1;
END //
DELIMITER ;
