TO_HEX

Return the hexadecimal value for a number.
TO_HEX(number)

where number is a BIGINT or INTEGER value or expression. This function does not work on SMALLINT columns.

For example:
premdb=# SELECT capacity, TO_HEX(capacity) 
FROM team ORDER BY teamid LIMIT 5;
 capacity | to_hex 
----------+--------
    60260 | eb64
    42785 | a721
    23009 | 59e1
    30016 | 7540
    31367 | 7a87
(5 rows)