TO_LONG()

Scalar. Converts a given value to a Long.

Syntax

TO_LONG(value)
Parameter

value

The value to convert. Numeric values return the integer portion of the value. Values outside the valid range for a Long, or non-numeric characters in a string value, return Null. An Interval returns a number of microseconds. A Timestamp returns a value representing the number of microseconds from the epoch (midnight, January 1, 1970 UTC). Timestamps prior to the epoch convert to a negative value.

Data Types

Return

value

Long

Integer

Long

Float

Interval

Timestamp

String

Examples

The following example employs the Long integer portion of a Float value in a calculation:

INSERT INTO OutStream
SELECT TO_LONG(Trades.Price/9.)>=5
FROM Trades;

The following example returns a number of microseconds:

INSERT INTO OutStream
SELECT TO_LONG(Trades.TradeTime)-TO_LONG(Trades.ExchangeTime)
FROM Trades;