Outdated Version

You are viewing an older version of this section. View current production version.

UNHEX

Converts a hexadecimal representation to the binary equivalent.

UNHEX (expression)

Arguments

  • expression: hexadecimal, in upper or lower case.

Return Type

Binary data.

Info

This function does not handle IPv6 addresses.

Examples

mysql> select hex('ohai');
+-------------+
| hex('ohai') |
+-------------+
| 6F686169    |
+-------------+

mysql> select unhex('6F686169');
+-------------------+
| unhex('6F686169') |
+-------------------+
| ohai              |
+-------------------+