DECLARE done INTEGER DEFAULT 0;
DECLARE cur CURSOR FOR SELECT f_time,f_value FROM this_yc201508;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done=1;
所有的变量都要定在游标之前,Handler要在游标之后。
否则会报错Variable or condition declaration after cursor or handler declaration
调试方法:SELECT输出
SET赋值。