MySQL 错误:您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在附近使用的正确语法
我有这样的存储过程:
CREATE PROCEDURE ProG()
BEGIN
SELECT * FROM `hs_hr_employee_leave_quota`;
END
但它给出了错误:
#1064
- 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 3 行 '' 附近使用的正确语法
该错误是什么意思?第 2 行有什么问题?
I have the Stored procedure like this:
CREATE PROCEDURE ProG()
BEGIN
SELECT * FROM `hs_hr_employee_leave_quota`;
END
But it gives the error:
#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
What does the error mean? What is wrong with line number 2?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
在使用触发器、存储过程等之前必须更改分隔符。
You have to change delimiter before using triggers, stored procedures and so on.
如何找出此 MySQL 错误试图说明的内容:
此错误中没有任何线索。您必须仔细检查所有这些项目,看看您的错误在哪里:
!@#$%^&*()-_=+[]{}\| ;:'",<>/?
select
、into
或无数其他关键字。将尽可能多地从损坏的查询中删除,直到下次它开始工作为止。语法报告系统。
How to find out what this MySQL Error is trying to say:
This error has no clues in it. You have to double check all of these items to see where your mistake is:
!@#$%^&*()-_=+[]{}\|;:'",<>/?
select
,into
, or countless others.Take away as much as you can from the broken query until it starts working. And then use PostgreSQL next time that has a sane syntax reporting system.
分隔符,分隔符...
当程序中有多个语句时,您确实需要它们。 (换句话说,您的代码中是否有
;
以及更多语句/命令?那么,您需要使用分隔符)。对于像你这样简单的程序,你可以这样做:
Delimiters, delimiters...
You really need them when there are multiple statements in your procedure. (in other words, do you have a
;
in your code and then more statements/commands? Then, you need to use delimiters).For such a simpler rpocedure as yours though, you could just do:
这可能是 mysql 的内存问题
尝试增加 my.ini 中的 max_allowed_packet
This might be a memmory issue on mysql
try to increase max_allowed_packet in my.ini
MYSQL PROCEDURE 步骤:
创建PROCEDURE,可以参考语法< /a>
注意:不要忘记以 ' 结束语句; '
MYSQL PROCEDURE steps:
create PROCEDURE, you can refer syntax
NOTE: Don't forget to end statement with ' ; '
我得到了同样的错误如下:
当使用尾随逗号时,如下所示:
因此,我删除了尾随逗号,如下所示,然后错误得到解决:
而且,我也遇到了以下相同的错误:
当
count
和(
之间没有空格时,如下所示,因为它被识别为 count() 这是MySQL中的内置函数:所以,我在
count
和(
之间留了一个空格,如下所示,然后错误就解决了:而且,我也得到了下面同样的错误:
当我给出 对所有数据库 (
*.person
) 中的用户john
person 表的 PROCESS 权限code> 与 GRANT 通过使用用户登录root
如下所示:因此,我对所有数据库(
*.*
)中的所有表授予了PROCESS
权限,如下所示,然后我可以解决错误。 *我的回答解释它更多:I got the same error below:
When using a trailing comma as shown below:
So, I removed the trailing comma as shown below, then the error was solved:
And, I also got the same error below:
When there is no space between
count
and(
as shown below because it's recognized as count() which is the built-in function in MySQL:So, I made a space between
count
and(
as shown below, then the error was solved:And, I also got the same error below:
When I gave PROCESS privilege on only
person
table in all databases (*.person
) to the userjohn
with GRANT by login with the userroot
as shown below:So, I gave
PROCESS
privilege on all the tables in all databases (*.*
) as shown below, then I could solve the error. *My answer explains it more: