1324- mysql中未定义的CURSOR

时间:2011-04-21 10:01:48

标签: mysql

begin
    declare  i integer;
    declare cur cursor for select ecmtwork.mttotalline from ectmwork;
    OPEN cur;
    repeat
        fetch cut into i;
        until i =  468;       
    end repeat;
    close cur;
end;

我尝试运行此程序, mysql显示错误信息('1324- mysql中未定义的CURSOR), 请告诉解决方案,我正在使用mysql server 5.0

2 个答案:

答案 0 :(得分:1)

看起来你在第6行中有错误的光标名称。 这条线

fetch cut into i;

应该是

fetch cur into i;

答案 1 :(得分:0)

你的程序应该是

   begin
declare  i integer;
declare cur cursor for select ecmtwork.mttotalline from ectmwork;
OPEN cur;
repeat
    fetch cur into i;
    until i =  468;       
end repeat;
close cur;
  end;