当第一个参数(即子字符串)或第二个参数(即子字符串)的值为NULL时,它将返回NULL作为输出。以下示例将演示它-
mysql> Select LOCATE(NULL,'Ram is a good boy')As Result; +--------+ | Result | +--------+ | NULL | +--------+ 1 row in set (0.00 sec) mysql> Select LOCATE('Ram',NULL)As Result; +--------+ | Result | +--------+ | NULL | +--------+ 1 row in set (0.00 sec)