From the table "redis-state" I want to get data with cursor in table and written this procedure, but I get an error
declare not founds 1064 error code
at line 10.
Purpose is to print the table all rows. One print for each entry in table.
[![enter image description here][2]][2]
CREATE PROCEDURE redisatestatedata()
BEGIN
DECLARE macaddress varchar(50);
DECLARE redisstate varchar(50);
DECLARE atehistorystate varchar(50);
DECLARE data_list varchar(50000);
DECLARE done INT DEFAULT FALSE;
DECLARE data_cursor CURSOR FOR
SELECT macaddress,redisstate,atehistorystate
FROM redis-atestate;
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET done = TRUE;
open data_cursor;
GET_DATA:loop FETCH data_cursor INTO
macaddress,redisstate,atehistorystate;
IF v_finished = 1 THEN
leave get_data;
ENDIF;
SET data_list = concat("Difference in state ATE:",macaddress,": redis ",redisstate,": dbstate ",atehistorystate);
SELECT data_list;
loop get_data;
CLOSE data_cursor;
END;
答案 0 :(得分:1)
我认为问题在于此声明:
DECLARE done INT DEFAULT FALSE;
您要为数据类型INT分配默认值false吗?