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个回答

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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问