May 2005
Intermediate to advanced
352 pages
14h 39m
English
UNHEX( )
UNHEX(string)This function converts hexadecimal
numbers to their character equivalent. It reverses the results of the
HEX( ) function. This function is available as of
Version 4.1.2 of MySQL.
SELECT ORD(UNHEX(MID('#FFFFFF', 2,2))) AS 'Red Value',
ORD(UNHEX(MID('#FFFFFF', 4,2))) AS 'Green Value',
ORD(UNHEX(RIGHT('#FFFFFF', 2))) AS 'Blue Value';
+-----------+-------------+------------+
| Red Value | Green Value | Blue Value |
+-----------+-------------+------------+
| 255 | 255 | 255 |
+-----------+-------------+------------+This SQL statement returns the RGB
values for the color white. The ORD( ) function is
used to convert the results of UNHEX( ) to plain
text.
Read now
Unlock full access