HEX

2024-12-02 03:48:26  Updated

Syntax

HEX(str)

Purpose

HEX() converts a number or string str to a hexadecimal string. Each byte of each character in str is converted into two hexadecimal digits.

For a numeric parameter N, UNHEX(N) is not the reverse operation of HEX(N). In this case, you need to use CONV(HEX(N),16,10).

Examples

obclient> SELECT HEX(255), HEX('abc');
+----------+------------+
| HEX(255) | HEX('abc') |
+----------+------------+
| FF       | 616263     |
+----------+------------+
1 row in set

Contact Us