top of page
CerebroSQL

HEX

База данных: MySQL

68747470733a2f2f7374796c65732e7265646469746d656469612e636f6d2f74355f32716d366b2f7374796c65

Syntax:
HEX(str), HEX(N)

For a string argument str, HEX() returns a hexadecimal string
representation of str where each byte of each character in str is
converted to two hexadecimal digits. (Multibyte characters therefore
become more than two digits.) The inverse of this operation is
performed by the UNHEX() function.

For a numeric argument N, HEX() returns a hexadecimal string
representation of the value of N treated as a longlong (BIGINT) number.
This is equivalent to CONV(N,10,16). The inverse of this operation is
performed by CONV(HEX(N),16,10).

URL: https://dev.mysql.com/doc/refman/8.0/en/string-functions.html

Example

mysql> SELECT X'616263', HEX('abc'), UNHEX(HEX('abc'));
-> 'abc', 616263, 'abc'
mysql> SELECT HEX(255), CONV(HEX(255),16,10);
-> 'FF', 255

bottom of page