zhidd
V2EX  ›  问与答

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

  •  
  •   zhidd · Aug 19, 2016 · 1693 views
    This topic created in 3566 days ago, the information mentioned may be changed or developed.
    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;
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1285 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 466ea39e · 36ms · UTC 17:19 · PVG 01:19 · LAX 10:19 · JFK 13:19
    ♥ Do have faith in what you're doing.