MySQL allows us to use integer values as arguments to the LOCATE() function. We don't need to use quotes. This can be demonstrated with the help of the following example -
mysql> Select LOCATE(5,1698235); +-------------------+ | LOCATE(5,1698235) | +-------------------+ | 7 | +-------------------+ 1 row in set (0.00 sec) mysql> Select LOCATE(56,1698235); +--------------------+ | LOCATE(56,1698235) | +--------------------+ | 0 | +--------------------+ 1 row in set (0.00 sec) mysql> Select LOCATE(23,1698235); +--------------------+ | LOCATE(23,1698235) | +--------------------+ | 5 | +--------------------+ 1 row in set (0.00 sec)
The above is the detailed content of What happens if I use an integer value as a parameter to the MySQL LOCATE() function?. For more information, please follow other related articles on the PHP Chinese website!