TO_INTEGER

Description

Converts a value to an Integer. If the input cannot be converted, the function throws an error.

Syntax

TO_INTEGER(string/decimal/double/float/integer) -> Integer

Parameters

ParameterData TypeRequiredDescription
string/decimal/double/float/integerString/Decimal/Double/Float/IntegerYesThe string to convert into a Integer

Examples

TO_INTEGER("25")
-- Returns 25 as an Integer.
TO_INTEGER(25.8)
-- Returns 25.

Tips

  • If the input is a string, it must represent an integer; otherwise, an error will occur.

  • For numeric inputs, any fractional part is truncated rather than rounded.