to_long()

Scalar. Converts a given value to a long.

Syntax

to_long ( value )

Parameters

value

A string, interval, date/time type, numeric type, or money type.

Usage

Converts a given string to a long. The function takes a string, interval, date/time type, numeric type, or money type as its argument, and the function returns a long. Note that the function can take a long as its argument, but it will return the same long.

Numeric types return the integer portion of the value. Strings with nonnumeric characters, or with values outside the valid range for a long, return NULL. An interval returns a number of microseconds. A date/time type returns a value representing the number of seconds, milliseconds, or microseconds from the epoch (midnight, January 1, 1970 UTC) depending on whether the input type is a date, timestamp or bigdatetime respectively. Those prior to the epoch convert to a negative value.

Example

to_long ('23')returns 23.