to_integer()

Scalar. Converts a given value to an integer.

Syntax

to_integer ( value )

Parameters

value

The boolean, money, string, date, or any numeric type value you wish to cast to integer.

Usage

Converts a given value to an integer. The function takes a string, date, or any numeric type as its argument, and the function returns an integer. Note that the function can take an integer as its argument, but it will return the same integer.

Numeric values return the integer portion of the value. Values outside the valid range for an integer, or nonnumeric characters in a string value, return NULL. A date returns a value representing the number of seconds from the epoch (midnight, January 1, 1970 UTC). Those prior to the epoch convert to a negative value.

Example

to_integer ('1')returns 1.