title: We have migrated from Mariadb 10.1.21 to mysql 5.6 using phpmyadmin 5.0. After migrating we are facing issues in stored procedure
body: <p>The stored procedure was working fine in Mariadb. After migrating to mysql it is not returning any rows nor any errors. Kindly help to resolve this.</p>
  <p><a href="https://i.stack.imgur.com/uJtKp.png" rel="nofollow noreferrer">enter image description here</a></p>
  <pre><code>DELIMITER $$
  CREATE DEFINER=`root`@`localhost` PROCEDURE `ONROLL`(IN `SCH_ID` INT, IN `YR_ID` INT)
      MODIFIES SQL DATA
  BEGIN
  DECLARE GRD_ID INT;
  DECLARE FINISHED INT;
  DECLARE GRD_CUR CURSOR FOR SELECT DISTINCT GRADE_ID FROM SECTION WHERE SCHOOL_ID = SCH_ID ORDER BY GRADE_ID ASC;
  DECLARE CONTINUE HANDLER FOR NOT FOUND SET FINISHED = 0;
  
  CREATE TEMPORARY TABLE ROLL(
  GRD_ID INT,
  COUNT INT);
  
  OPEN GRD_CUR;
  LOOPROWS:LOOP
  
  FETCH GRD_CUR INTO GRD_ID;
  
  IF FINISHED = 0 THEN
      LEAVE LOOPROWS;
  END IF;
  
  INSERT INTO ROLL (GRD_ID,COUNT)
  SELECT GRD_ID,COUNT(U.ID) FROM USER U JOIN USER_CURRICULUM UC ON UC.USER_ID=U.ID JOIN COHORTS_STUDENTS CS ON CS.STUDENTS_ID=UC.USER_ID AND CS.ACADEMIC_YEAR=UC.YEAR_ID JOIN COHORTS C ON C.ID = CS.COHORTS_ID WHERE UC.SCHOOL_ID=SCH_ID AND UC.GRADE_ID=GRD_ID AND UC.YEAR_ID=YR_ID;
  
  END LOOP;
      CLOSE GRD_CUR;
      SELECT * FROM ROLL;
      DROP TABLE ROLL;
  END$$
  DELIMITER ;
  </code></pre>