unhex
Description
Syntax:
VARCHAR unhex(VARCHAR str)
If the length of the input string is 0 or odd, this function will return an empty string. If the string contains characters other than [0-9], [a-f], [A-F]
, it will also return an empty string. In other cases, it will convert every two characters of the string into a hexadecimal and cocatenate them into a string.
Example
mysql> select unhex('@');
+------------+
| unhex('@') |
+------------+
| |
+------------+
mysql> select unhex('41');
+-------------+
| unhex('41') |
+-------------+
| A |
+-------------+
mysql> select unhex('4142');
+---------------+
| unhex('4142') |
+---------------+
| AB |
+---------------+
Keywords
UNHEX