When MySQL FIND_IN_SET() function returns NULL as output?

MySQLMySQLi Database

FIND_IN_SET() function returns NULL as output if any of the argument i.e. either search string or string list, is NULL. Of course, It will also return NULL if both of the arguments are NULL.

Example

mysql> Select FIND_IN_SET(NULL,'Ram is a good boy') AS Result;
+--------+
| Result |
+--------+
| NULL   |
+--------+
1 row in set (0.00 sec)

mysql> SELECT FIND_IN_SET('RAM',NULL)AS RESULT;
+--------+
| RESULT |
+--------+
| NULL   |
+--------+
1 row in set (0.00 sec)

mysql> SELECT FIND_IN_SET(NULL,NULL);
+------------------------+
| FIND_IN_SET(NULL,NULL) |
+------------------------+
|                   NULL |
+------------------------+
1 row in set (0.00 sec)
raja
Published on 20-Feb-2018 10:50:08
Advertisements