V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
zhidd
V2EX  ›  问与答

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

  •  
  •   zhidd · 2016-08-19 22:37:22 +08:00 · 1311 次点击
    这是一个创建于 2815 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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;
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2502 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 06:40 · PVG 14:40 · LAX 23:40 · JFK 02:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.