MySQL Function Does Not Exist Error
I tried to execute a query for MySQL database and kept getting this error:
ERROR 1064 (42000): 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 '* ) from table1' at line 1
And the query is extremely simple as follow:
select count (*) from table1;
It is getting so frustrating and unbelievable… so I googled (hahaha)… well I did found out the solution… It is complaining the space between “count” and “(”!!! WHAT the hack (sorry I borrowed the phase from Rachel)? Once I removed the space the query runs!
select count(*) from table1;
Here is the “explaination” from MySQL:
“By default, there must be no whitespace between a function name and the parenthesis following it. This helps the MySQL parser distinguish between function calls and references to tables or columns that happen to have the same name as a function. However, spaces around function arguments are permitted.”
“You can tell the MySQL server to accept spaces after function names by starting it with the –sql-mode=IGNORE_SPACE option.”
Unbelievable!!!! By the way, there is also another variation of the error message:
ERROR 1305 (42000): FUNCTION sampledb.COUNT does not exist
Oh well…



