日期:2014-05-16 浏览次数:20913 次
mysql> DELIMITER // mysql> CREATE PROCEDURE updataAlarmID() -> BEGIN -> set @i=0; -> set @sqlcot="select count(overinfo.rule) into @rlenght from overinfo,inid ate where overinfo.classID=inidate.classID and inidate.alarmID is null"; -> PREPARE prod FROM @sqlcot; -> EXECUTE prod; -> -> set @sqlRule1="select overinfo.rule into @ruleWord from overinfo,inidate where overinfo.classID=inidate.classID and inidate.alarmID is null limit "; -> set @sqlin1="update inidate,overinfo set inidate.alarmID=overinfo.alarmID where inidate.content "; -> set @sqlin2=" and inidate.classID=overinfo.classID and ov erinfo.rule= "; -> -> while @i<@rlenght do -> set @sqlRule=concat(@sqlRule1,@i,",1"); -> PREPARE proRule FROM @sqlRule; -> EXECUTE proRule; -> @sqlIn=concat(@sqlin1,@ruleWord,@sqlin2,@ruleWord); -> PREPARE proIn FROM @sqlIn; -> EXECUTE proIn; -> set @i=@i+1; -> end while; -> -> END -> // ERROR 1064 (42000): 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 '@sqlI n=concat(@sqlin1,@ruleWord,@sqlin2,@ruleWord); PREPARE proIn FROM ' at line 14
ERROR 1193 (HY000): Unknown system variable 'i'