错误#1064 - 您的SQL语法出错;查看与MySQL服务器版本对应的手册

时间:2012-04-28 10:59:39

标签: mysql sql mysql-error-1064

有人告诉哪里有错误?

CREATE PROCEDURE catalog_get_departments_list()
BEGIN
SELECT department_id, name FROM department ORDER BY department_id;
END$$

这个错误崩溃了:

#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 

2 个答案:

答案 0 :(得分:2)

我认为你应该在最后删除美元:

CREATE PROCEDURE catalog_get_departments_list()
BEGIN
SELECT department_id, name FROM department ORDER BY department_id;
END

或设置分隔符

DELIMITER $$
CREATE PROCEDURE catalog_get_departments_list()
BEGIN
SELECT department_id, name FROM department ORDER BY department_id;
END$$

答案 1 :(得分:0)

MySQL客户端的另一个变种 -

CREATE PROCEDURE catalog_get_departments_list()
SELECT department_id, name FROM department ORDER BY department_id;