ID EN
String Functions and Operators

HEX(str)

MySQL 8.4 🇮🇩 Bahasa Indonesia

HEX(str), HEX(N)

Syntax

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

Contoh

Example

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.

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