MySQL - 错误#1193 - 未知的系统变量' FETCH_STATUS'

时间:2015-07-14 09:11:03

标签: mysql

在创建以下存储过程时创建进程时出现上述错误。请帮我解决这个问题。下面给出了存储过程的定义。提前谢谢

这是我的代码

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 ;

0 个答案:

没有答案