Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2023-09-09 08:01:09
forward
1331 people have browsed it

如果我们提供 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)
Copy after login

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!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!