hex
description
Syntax
VARCHAR hex(VARCHAR str)
VARCHAR hex(BIGINT num)
If the input parameter is a number, the string representation of the hexadecimal value is returned;
If the input parameter is a string, each character will be converted into two hexadecimal characters, and all the characters after the conversion will be spliced into a string for output
example
1. input string
3. mysql> select hex('1');
4. +----------+
5. | hex('1') |
6. +----------+
7. | 31 |
8. +----------+
10. mysql> select hex('@');
11. +----------+
12. | hex('@') |
13. +----------+
14. | 40 |
15. +----------+
17. mysql> select hex('12');
18. +-----------+
19. | hex('12') |
20. +-----------+
21. | 3132 |
22. +-----------+
1. intput num
3. mysql> select hex(12);
4. +---------+
5. | hex(12) |
6. +---------+
7. | C |
8. +---------+
10. mysql> select hex(-1);
11. +------------------+
12. | hex(-1) |
13. +------------------+
14. | FFFFFFFFFFFFFFFF |
15. +------------------+
keywords
1. HEX
