unhex

description

Syntax

VARCHAR unhex(VARCHAR str)

Enter a string, if the length of the string is 0 or an odd number, an empty string is returned; If the string contains characters other than [0-9], [a-f], [A-F], an empty string is returned; In other cases, every two characters are a group of characters converted into hexadecimal, and then spliced into a string for output.

example

1. mysql> select unhex('@');
2. +------------+
3. | unhex('@') |
4. +------------+
5. |            |
6. +------------+

8. mysql> select unhex('41');
9. +-------------+
10. | unhex('41') |
11. +-------------+
12. | A           |
13. +-------------+

15. mysql> select unhex('4142');
16. +---------------+
17. | unhex('4142') |
18. +---------------+
19. | AB            |
20. +---------------+

keywords

1. UNHEX