Home  >  Article  >  Database  >  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
WBOYforward
2023-08-29 22:49:021338browse

如果我们提供大于 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)

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!

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