TO_HEX
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
The TO_HEX()
function translates a numeric value to its hexadecimal string counterpart.
SELECT to_hex(255);
create.select(toHex(255)).fetch();
The result being
+--------+ | to_hex | +--------+ | ff | +--------+
Dialect support
This example using jOOQ:
toHex(255)
Translates to the following dialect specific expressions:
CockroachDB, DB2, Postgres, Redshift, Vertica, YugabyteDB
to_hex(255)
H2, Oracle
trim(to_char(255, 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'))
MariaDB, MySQL
hex(255)
SQLite
printf('%X', 255)
SQLServer
format(255, 'X')
Trino
to_base(255, 16)
ASE, Access, Aurora MySQL, Aurora Postgres, BigQuery, ClickHouse, Derby, DuckDB, Exasol, Firebird, HSQLDB, Hana, Informix, MemSQL, SQLDataWarehouse, Snowflake, Sybase, Teradata
/* UNSUPPORTED */
Generated with jOOQ 3.20. Translate your own SQL on our website
Feedback
Do you have any feedback about this page? We'd love to hear it!