DB2 Scalar functions - TO_HEX


Volta a página anterior

Volta ao Menu das scalar functions

Volta ao Menu Principal


Desenvolvido por DORNELLES Carlos Alberto - Analista de Sistemas - Brasília DF. - cad_cobol@hotmail.com

ABS or ABSVAL

The TO_HEX function converts a numeric expression into the hexadecimal representation.

TO_HEX(expression)

The schema is SYSIBM.

expression
The expression must return a value that is a built-in character string, Boolean value, or numeric value.
In a Unicode database, the expression can also return a graphic string, in which case it is first converted to a character string before the function is evaluated.
If the data type of the input is not SMALLINT, INTEGER, or BIGINT, it is implicitly cast to BIGINT before the function is evaluated.

Result

The data type of the result depends on the data type of the input expression:

  • For SMALLINT input, the result is VARCHAR(4).
  • For INTEGER input, the result is VARCHAR(8).
  • For BIGINT input, the result is VARCHAR(16).

If the argument can be null, the result can be null.
If the argument is null, the result is the null value.

Example

   values to_hex(565);

     returns value 235.


© Copyright IBM Corp.