Mysql不支持单行注释。原因是什么? [英] Mysql is not supporting single line comments here. What would be the reason.?
问题描述
这是我使用单行注释时使用的(使用 - )。错误1064(42000):您的SQL语法有错误;实际上,我在一个过程中使用这些注释来显示一行是什么。然后我直接检查在mysql命令行,但我得到这个错误。
Here is what I am getting when I use single line comment (using --). ERROR 1064 (42000): You have an error in your SQL syntax; Actually I am using these comments in a procedure to show what exactly a line does. Then i checked directly at mysql command line, but I got this error.
mysql> select 1;--test select
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)
-> ;
check the manual that corresponds to your MySQL server version for the right syntax to use near '--test select' at line 1
Do I need to configure any file to support this. It is working fine, If I use Multi-line comments(Using /*something*/).
我googled并通过mysql文档,它显示了我,它supppots - )。
可能对我的过程来说不重要,但只想知道它的错误是什么。
I googled and went through mysql documentation, in that It shown me, It supoppots( -- ). May be it is not important for my procedures, but just want to know what is the error in it.
推荐答案
从mysql文档:
从 - 序列到行尾。在MySQL中, - (双破折号)注释样式需要第二个破折号后面跟着
至少一个空格或控制字符(如空格,制表符,
换行符等on)。
From a "-- " sequence to the end of the line. In MySQL, the "-- " (double-dash) comment style requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, newline, and so on).
因此,在 -
后需要一些空格字符示例:
So you need some space character after --
, for example:
mysql> select 1;-- test select
这篇关于Mysql不支持单行注释。原因是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!