zylZYL13621804880 2019-06-11 11:52 采纳率: 0%
浏览 774
已采纳

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);

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试