to_hex() 是一个系统函数,用于将整数转换为其十六进制字符串等价物。
to_hex() 添加于 PostgreSQL 7.3。
示例
to_hex() 的基本用法示例
postgres=# SELECT to_hex(255); to_hex -------- ff (1 row)
将 bigint 转换为十六进制
postgres=# SELECT to_hex(-2401053088876216593);
to_hex
------------------
deadbeefdeadbeef
(1 row)
参考资料
- PostgreSQL 文档: 其他字符串函数
