Available in versions: Dev (3.16) | Latest (3.15)

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

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, YUGABYTE
to_hex(255)

-- H2, ORACLE
trim(to_char(255, 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'))

-- MARIADB, MYSQL
hex(255)

-- SQLITE
printf('%X', 255)

-- SQLSERVER
format(255, 'X')

-- ACCESS, ASE, AURORA_MYSQL, AURORA_POSTGRES, BIGQUERY, DERBY, EXASOL, FIREBIRD, HANA, HSQLDB, INFORMIX, MEMSQL, SNOWFLAKE, 
-- SQLDATAWAREHOUSE, SYBASE, TERADATA
/* UNSUPPORTED */

(These are currently generated with jOOQ 3.16, 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