zylZYL13621804880
2019-06-11 11:52
采纳率: 14.3%
浏览 684

mysql 存储过程定义变量出错

各位大佬帮忙看看哪里有语法错误
CREATE PROCEDURE update_customer_code ()
BEGIN
DECLARE mysort INT;
   
   

    DECLARE done tinyint;

        DECLARE customerId VARCHAR;
        DECLARE cur CURSOR FOR SELECT customer_id FROM customer_association_process;

    OPEN cur;  
WHILE done DO
FETCH cur INTO customerId;

                CALL superior_splice (customerId);

     
SET mysort = mysort + 1;   
END
WHILE;
    CLOSE cur;
END;

错误提示:
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 
    SET mysort = 1;
    DECLARE done tinyint;
SET done = 1;
D' at line 4

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • 德玛洗牙 2019-06-11 13:25
    已采纳

    DECLARE customerId VARCHAR; 你这一句有问题 你定义varchar要指定长度如改为DECLARE customerId VARCHAR(100);

    点赞 打赏 评论

相关推荐 更多相似问题