MySQL储存过程报1064错误
CREATEDEFINER=CURRENT_USERPROCEDURE`NewProc3`()BEGINDECLAREtableNameVARCHAR(20);DECLA...
CREATE DEFINER = CURRENT_USER PROCEDURE `NewProc3`()
BEGIN
DECLARE tableName VARCHAR(20);
DECLARE sqlStatement VARCHAR(400);
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 '' at line 3
多谢各位了 展开
BEGIN
DECLARE tableName VARCHAR(20);
DECLARE sqlStatement VARCHAR(400);
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 '' at line 3
多谢各位了 展开
展开全部
DELIMITER $$
CREATE DEFINER = CURRENT_USER PROCEDURE `NewProc3`()
BEGIN
DECLARE tableName VARCHAR(20);
DECLARE sqlStatement VARCHAR(400);
END$$
DELIMITER ;
DELIMITER修改mysql结束符。
默认以;为结束符,也就是检测到;就会执行,但存储过程显然是一个整段,必须一起执行,单独执行肯定报错。
所以只有在执行存储过程时先修改掉默认的结束符,等执行完后再改回去。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询