Home > Database > Mysql Tutorial > What will MySQL return if we provide a value greater than 255 as a parameter to the MySQL CHAR() function?

What will MySQL return if we provide a value greater than 255 as a parameter to the MySQL CHAR() function?

WBOY
Release: 2023-08-29 22:49:02
forward
1402 people have browsed it

如果我们提供大于 255 的值作为 MySQL CHAR() 函数的参数,MySQL 将返回什么?

#MySQL converts arguments to the CHAR() function that are greater than 255 into multiple result bytes. For example, CHAR(260) is equivalent to CHAR(0,1,0,4). It will be clearer with the following statement -

mysql> Select HEX(CHAR(256)),HEX(CHAR(1,0));
+----------------+----------------+
| HEX(CHAR(256)) | HEX(CHAR(1,0)) |
+----------------+----------------+
| 0100           | 0100           |
+----------------+----------------+
1 row in set (0.00 sec)
Copy after login

The above result set shows that CHAR(256) is equivalent to CHAR(1,0).

The above is the detailed content of What will MySQL return if we provide a value greater than 255 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