Thanks for coming to ITKE.
You can use the ‘x’ format element. If you want to convert from hexa to decimal, you use the TO_NUMBER function:
SELECT to_number( 'f', 'x' )
And if you want to convert from decimal to hexa, you use the TO_CHAR function:
SELECT TO_CHAR(15, 'x' )
The number of ‘x’ you use defines the number of chars in the hexa value, so make sure to provide enough ‘x’ to cover all the possible values you plan to convert.
To_char adds a leading blank space (reserved in case it needs to add a – sign for negative numbers). If you don’t want that leading blank, you can combine the ‘fm’ format element, this way:
SELECT TO_CHAR(15, 'fmx' )