v.19.17New Feature

Created Function Hex for Decimal Numbers

Created function hex for Decimal numbers. It works like hex(reinterpretAsString()), but does not delete last zero bytes. #7355 (Mikhail Korotov)
Added a new function hex for Decimal numbers that converts them to their hexadecimal representation without removing trailing zero bytes.

Why it matters

This feature addresses the limitation of the previous hex(reinterpretAsString()) approach, which removed trailing zero bytes in Decimal numbers when converting to hexadecimal. By preserving these zero bytes, the new hex function provides a more accurate and reliable hexadecimal representation of Decimal values.

How to use it

Use the hex function directly on Decimal columns or values to obtain their full hexadecimal representation including trailing zeros. For example:

SELECT hex(your_decimal_column) FROM your_table;