Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query optimization, and usability that you won’t want to miss.

UNHEX

Converts a hexadecimal representation to the binary equivalent.

Syntax

UNHEX(expression)

Arguments

expression

A hexadecimal expression, in upper or lower case.

Return Type

Binary data.

Examples

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

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

Related Topics