【mysql报错】1064 - You have an error in your SQL syntax;

mysql 报错1064 - You have an error in your SQL syntax;

数据库版本:mysql5.7;系统版本:CentOS Linux7.5

场景:
执行下面的存储过程
CREATE PROCEDURE pro_dw_gs()
BEGIN
select * from ods_ban_nnn;
END

报错如下:
CREATE PROCEDURE pro_dw_gs()
BEGIN
select * from ods_ban_nnn
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
时间: 0.001s

解决:
在存储过程前后添加DELIMITER //和// DELIMITER ;

正确的存储过程为:
DELIMITER //
CREATE PROCEDURE pro_test_nnn()
BEGIN
select * from ods_ban_nnn;
END
//
DELIMITER ;

 

你可能感兴趣的:(mysql报错)