我有一张表,其中的message列是varchar类型。
mysql> select * from todel;
+---------+
| message |
+---------+
| 73, 116 |
+---------+
1 row in set (0.00 sec)
我无法将ASCII值转换为字符串。
mysql> select char(message) from todel;
+---------------+
| char(message) |
+---------------+
| I |
+---------------+
1 row in set, 1 warning (0.01 sec)
mysql> show warnings;
+---------+------+----------------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: '73, 116' |
+---------+------+----------------------------------------------+
1 row in set (0.00 sec)
如果我直接使用char函数,那么它会按预期工作:
mysql> select char(73, 116);
+---------------+
| char(73, 116) |
+---------------+
| It |
+---------------+
1 row in set (0.00 sec)
我如何在从表中选择varchar数据时使用"char"函数?