Syntax
UNHEX(str)
Purpose
Converts hexadecimal digits in the string str to bytes and returns the binary string.
The characters in the string str must be values in the range 0 to 9, A to F, and a to f. If the string contains any non-hexadecimal characters, the function returns NULL.
If str is a column of the BINARY data type and contains bytes filled with 0x00, the function also returns NULL. For a numeric parameter N, UNHEX(N) is not the inverse of HEX(N). In this case, you can use CONV(HEX(N),16,10) instead.
Specifically, you can use the --binary-as-hex parameter in the client connection string to indicate that binary strings should be represented in hexadecimal.
Examples
obclient> SELECT UNHEX('4f6365616e42617365');
+-----------------------------+
| UNHEX('4f6365616e42617365') |
+-----------------------------+
| OceanBase |
+-----------------------------+
1 row in set
obclient> SELECT X'4f6365616e42617365';
+-----------------------+
| X'4f6365616e42617365' |
+-----------------------+
| OceanBase |
+-----------------------+
1 row in set
