Conversion Functions

Conversion functions are used to change the data type of a numeric expression. Conversion functions should be used to ensure that arguments in a comparison function have the same data type.

Function: boolean(numeric_expr)

This function returns:TRUE if numeric_expr is not 0 and not NULL.FALSE if numeric_expr is 0.NULL if numeric_expr is NULL.For example:

SELECT boolean(1), boolean(87.35), boolean(0), boolean(null)
|
-->  true, true, false, null

Function: float(expr)

This function returns the argument as a double. The argument can be a string, such as '45.78'. The function returns NULL for non-numeric values.

SELECT float(1), float('87.35'), float('david')
|
-->  1.0, 87.35, null

Function: integer(expr)

This function returns the argument as a 64-bit integer. The function accepts:Strings such as '45'.Hexadecimals such as '0x2D'.Octals such as '055'.The function returns NULL for non-integer values.

SELECT integer(1.5), integer('1.5'), integer('87'), integer('088')
|
-->  1, null, 87, 88

Function: string(numeric_expr)

This function returns the numeric argument as a string.

SELECT string(1.5), string(45)
|
-->  '1.5', '45'