MySQL - Bug # 1193 - Unknown system variable 'FETCH_STATUS'

I got the above error while creating a process while creating the following stored procedure. Please help me to solve this problem. The definition of a stored procedure is shown below. thanks in advance

Here is my code

DELIMITER $$
DROP PROCEDURE IF EXISTS 

`sp_rpt_process_status`$$


CREATE DEFINER=`saumitra`@`localhost` PROCEDURE `sp_rpt_process_status`()
BEGIN

DECLARE reqs_id INT(11);
DECLARE app_id INT(11);
DECLARE ap_name varchar(100);

declare cur CURSOR for
    select table_id from aerion.rpt_process where table_update='dev_est_reqs';

open cur;

fetch next from cur into reqs_id;

while     @@FETCH_STATUS = 0 BEGIN

    SELECT iddev_est INTO est_id, iddev_apps INTO app_id from aerion.dev_est where iddev_est_reqs=reqs_id;
    SELECT app_name INTO ap_name FROM dev_apps WHERE iddev_apps=app_id;
    INSERT INTO `rpt_dev_status`(`rpt_dev_app`) VALUES (ap_name); 
    fetch next from cur into reqs_id;

END

close cur
deallocate cur

END$$

DELIMITER ;

      

+3


source to share





All Articles