原存储过程
BEGIN
DECLARE tmp tinyint default 0;
DECLARE state int(16);
DECLARE cur CURSOR FOR SELECT skf1336 FROM skt32 where skf411 = OrderId;
OPEN cur;
while true do
fetch cur into state;
if state > 0 then
set tmp = 2;
end if;
end while;
close cur;
if tmp > 0 then
OPEN cur;
while true do
fetch cur into state;
if state < 2 then
set tmp = 1;
end if;
end while;
close cur;
end if;
UPDATE skt31 set skf1499 = tmp where skf393 = OrderId;
End;
报错:
1329 - No data - zero rows fetched, selected, or processed
在网上搜说是数据类型不匹配。结构搞了半天发现while是死循环的话也会报1329…
要是也碰到1329可以先检查一下循环结构。