Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15

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 */

(These are currently generated with jOOQ 3.20, see #10141), or translate your own on our website

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo