mysql 获取字符串的 ascii 代码转储 [英] mysql get ascii code dump for string

查看:37
本文介绍了mysql 获取字符串的 ascii 代码转储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 MySQL 中,是否有一种方法可以通过简单的 SELECT 获得 varchar 值中每个字符的 ASCII 代码/代码点序列?我对Oracle比较熟悉,它有DUMP函数可以使用为此.

In MySQL, is there a way in a simple SELECT to obtain a sequence of ASCII code/code points for each character in a varchar value? I'm more familiar with Oracle, which has the DUMP function that can be used for this.

例如,select some_function('abcd') 会返回类似 96,97,98,99?

For example, select some_function('abcd') would return something like 96,97,98,99?

推荐答案

这大约是我所知道的 MySQL 中最接近的等价物:

This is about the closest equivalent I'm aware of in MySQL:

mysql> select hex('abcd');
+-------------+
| hex('abcd') |
+-------------+
| 61626364    |
+-------------+
1 row in set (0.00 sec)

这篇关于mysql 获取字符串的 ascii 代码转储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆