DECLARE _roomidlist cursor for SELECT fat_roomtype_temp.Id, fat_roomtype_temp.HotelRoomId, fat_roomtype_temp.RoomCode FROM fat_roomtype_temp;declare continue handler for 1329 set _done = 1;OPEN _roomidlist;
REPEAT
set _aaa = _aaa +1 ;
fetch _roomidlist  into _id , _hotelId , _roomType ;SELECT t_dailyrates.DailyRatesID, t_dailyrates.SingleRates 
into  _DailyRatesID, _SingleRates
FROM t_dailyrates WHERE t_dailyrates.RoomType =  _roomType AND t_dailyrates.RefID = _hotelId ORDER BY t_dailyrates.SingleRates ASC limit 1 ;
UPDATE `fat_roomtype_temp` SET `DisplayPrice`=_SingleRates WHERE (`Id`= _id )  ;
commit;until _done=1 END REPEAT;
CLOSE _roomidlist;
存储过程主要如上。主要是实现遍历fat_roomtype_temp表,根据fat_roomtype_temp中的字段查询t_dailyrates表的SingleRates值,再将SingleRates值写回fat_roomtype_temp表问题是:为了防止游标越界,定义了“没有可取回数据出错处理” declare continue handler for 1329 set _done = 1;
但是在执行上面蓝色字体查询语句时返回值为空,即触发了“没有可取回数据出错处理” 执行set _done = 1的操作,致使循环结束关闭游标。而我要的效果是即使蓝色字体查询语句返回为空,游标照样从头到尾遍历,有数据就修改,没数据就pass 。
求高手帮帮忙,急啊~~~~