mysql 存储过程,错在哪了,怎么报错了

2016-08-19 22:37:22 +08:00
 zhidd
Create PROCEDURE Kucun(oid int,sid int)
begin
DECLARE s TINYINT;
DECLARE g TINYINT;
DECLARE n TINYINT;
DECLARE a TINYINT;
DECLARE cursorDone INT DEFAULT 0;
select status INTO s from iwebshop_seller_order where id=order_id and user_id=seller_id;
IF s=3 THEN
update iwebshop_seller_order set status ='4',confirm_time=now() where id=oid and user_id=sid;
DECLARE cur CURSOR FOR select goods_id,goods_nums from iwebshop_seller_order_goods where order_id = oid;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET cursorDone = 1;
open cur;
FETCH cur INTO g,n;
select count(*) INTO a from iwebshop_seller_kucun where seller_id=sid and gid=g;
IF a>0 THEN
update iwebshop_seller_kucun set num =num+n where gid=g and seller_id=sid;
ELSE
insert into iwebshop_seller_kucun VALUES ('',sid,g,n);
END IF;
CLOSE cur;
END IF;
end;
1334 次点击
所在节点    问与答
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/300540

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX