当第一个参数(即子字符串)或第二个参数(即子字符串)的值为 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)