Home > Database > Mysql Tutorial > body text

When MySQL LOCATE() function returns NULL as output?

WBOY
Release: 2023-08-31 17:49:02
forward
961 people have browsed it

当 MySQL LOCATE() 函数返回 NULL 作为输出时?

When the value of the first parameter (i.e. substring) or the second parameter (i.e. substring) is NULL, it will return NULL as output. The following example will demonstrate it -

Example

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)
Copy after login

The above is the detailed content of When MySQL LOCATE() function returns NULL as output?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template