mysql存储过程,open语法报错
代码:CREATEPROCEDUREcurdemo()BEGINDECLAREcur1CURSORFORselect`id`fromxin_inspirationwher...
代码 :
CREATE PROCEDURE curdemo()
BEGIN
DECLARE cur1 CURSOR FOR select `id` from xin_inspiration where `userid` = 57371
OPEN cur1
read_loop: LOOP
FETCH cur1 INTO a
IF done THEN
LEAVE read_loop
END IF
update xin_inspiration set num = (select count(id) from xin_inspimage where inspid = a) where id = a
END LOOP
CLOSE cur1
END; 展开
CREATE PROCEDURE curdemo()
BEGIN
DECLARE cur1 CURSOR FOR select `id` from xin_inspiration where `userid` = 57371
OPEN cur1
read_loop: LOOP
FETCH cur1 INTO a
IF done THEN
LEAVE read_loop
END IF
update xin_inspiration set num = (select count(id) from xin_inspimage where inspid = a) where id = a
END LOOP
CLOSE cur1
END; 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询