Home >Database >Mysql Tutorial >What happens if we provide NULL as a parameter to the MySQL CHAR() function?

What happens if we provide NULL as a parameter to the MySQL CHAR() function?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBforward
2023-09-09 08:01:091425browse

如果我们提供 NULL 作为 MySQL CHAR() 函数的参数,会发生什么?

The MySQL CHAR() function ignores NULL if NULL is provided as a parameter. To understand it, consider the following example -

mysql> Select CHAR(65,66,67,NULL);
+---------------------+
| CHAR(65,66,67,NULL) |
+---------------------+
| ABC                 |
+---------------------+
1 row in set (0.00 sec)

mysql> Select CHAR(NULL,66,67,NULL);
+-----------------------+
| CHAR(NULL,66,67,NULL) |
+-----------------------+
| BC                    |
+-----------------------+
1 row in set (0.00 sec)

In both the above examples, the CHAR() function ignores NULL and converts the numeric value to a character value.

The above is the detailed content of What happens if we provide NULL as a parameter to the MySQL CHAR() function?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete