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
mysql


source to share


No one has answered this question yet

See similar questions:

2
How to convert a SQL Server cursor to MySQL equivalent

or similar:

2568
Should I be using the datetime or timestamp datatype in MySQL?
1290
How do I get a list of user accounts using the command line in MySQL?
3
Mysql Call Stored Procedure from Another Stored Procedure
2
Use variable when declaring cursor
1
SQL - delete rows in all tables based on column value
1
Querying a stored function in mysql
1
Using prepared statements with a cursor
0
how to solve syntax error in a procedure in mysql?
0
mysql stored procedure
0
MySQL Routine not assigning a value to a variable?



All Articles
Loading...
X
Show
Funny
Dev
Pics