What is the use of MySQL UNHEX() function?

MySQLMySQLi Database

As its name suggests, it is the opposite of HEX() function. Basically, UNHEX() function converts the hexadecimal number into the byte represented by the number. The value returned by it would be a binary string.

Syntax

UNHEX(str)

Here, str is a string which is to be converted into the byte represented by the number. The characters in the str must be a valid hexadecimal digit.

Example

mysql> Select UNHEX('5475746F7269616C73706F696E74');
+---------------------------------------+
| UNHEX('5475746F7269616C73706F696E74') |
+---------------------------------------+
| Tutorialspoint                        |
+---------------------------------------+
1 row in set (0.00 sec)
raja
Updated on 20-Jun-2020 11:57:23

Advertisements