首页 文章

如何解决mysql中的语法错误?

提问于
浏览
0

我在mysql中执行一个程序,程序是 -

delimiter $$
create procedure getFacility (in id int, out MyFacility VARCHAR(200))
begin
    select Facility into MyFacility 
        from facilities 
        where FacilityID = id ;
end $$
delimiter ;

它在下面给出错误 -

Error Code : 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 'end $$
delimiter' at line 1
(0 ms taken)

如何解决这个错误?

谢谢,
Yugal

2 回答

  • 0

    我认为错误是因为 END$$ 之间的空格 . 尝试 END$$ ,它应该正确编译 .

    http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html

  • 0

    我有同样的问题...我的解决方案是在第一行删除分隔符操作符调用,并在'END'之后删除分隔符...似乎JDBC只是不喜欢该运算符 .

    如果MYSQL在语法错误方面提供更多精确度,那也是非常好的 .

相关问题