如何计算光标中的循环次数
declare counter int;
set counter := 1;
open cursor1;
LOOP1: loop
set counter := counter + 1;
end loop LOOP1;
但我收到错误:
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set counter := counter + 1;
end loop LOOP1;
答案 0 :(得分:1)
也许您必须删除:
中的set
才能解决sql语法错误:
set counter = 1;
和
set counter = counter + 1;