TO_HEX
Returns a VARCHAR or VARBINARY representing the hexadecimal equivalent of a number. This function is the inverse of HEX_TO_BINARY.
Behavior Type
Syntax
TO_HEX ( number )
Parameters
number |
An INTEGER or VARBINARY value to convert to hexadecimal. If you supply a VARBINARY argument, the function's return value is not preceded by |
Examples
=> SELECT TO_HEX(123456789); TO_HEX --------- 75bcd15 (1 row)
For VARBINARY inputs, the returned value is not preceded by 0x
. For example:
=> SELECT TO_HEX('ab'::binary(2)); TO_HEX -------- 6162 (1 row)