Use CAST to print values of solidDB database table in Hex

Disclaimer : All the postings on this site are my own and don’t necessarily represent IBM’s positions, strategies or opinions.
Use CAST function to print values of solidDB database table in Hex

In certain cases we would have stored hexadecimal values in a solidDB table with type as  DECIMAL, NUMERIC, SMALLINT, INTEGER, TINYINT, BIGINT etc. or any other numeric formats as required.

Generally used “SELECT *” queries would print them in decimal format. We can use the SQL-92 CAST function to get the output in hexadecimal format.

The below DESCRIBE query provides information about the database table EXAMPLE :

Using “SELECT *” would print the values like this in decimal format :

Using CAST function to print the values in Hexadecimal :

This output in hexadecimal is more readable as the values stored corresponded to these. The column headers though can be made more readable by using the SQL alias or AS operator :

Using the AS operator has made the column headers more readable.

More information on the usage of SQL-92 CAST function cab be found here :

What do you think ?