存储过程建立报错
CREATE PROCEDURE 'seckill'.'execute_seckill'(IN v_seckill_id bigint,IN v_phone bigint,IN v_kill_time TIMESTAMP ,out r_result INT )
BEGIN
DECLARE insert_count INT DEFAULT 0;
start TRANSACTION ;
INSERT ignore INTO success_killed(seckill_id,user_phone,create_time) VALUES (v_seckill_id,v_phone,v_kill_time);
SELECT ROW_COUNT() INTO insert_count;
IF(insert_count==0) THEN
ROLLBACK ;
SET r_result=-1;
ELSEIF(insert_count<0) THEN
ROLLBACK ;
SET r_result=-2;
ELSE
update seckill set number = number - 1
where seckill_id = #{seckillId}
and start_time <= #{killTime}
and end_time >= #{killTime}
and number > 0;
SELECT ROW_COUNT() INTO insert_count;
IF(insert_count==0) THEN
ROLLBACK ;
SET r_result=0;
ELSEIF(insert_count<0) THEN
ROLLBACK ;
SET r_result=-2;
ELSE
COMMIT ;
SET r_result=1;
END IF;
END IF;
END ;
$$