GetLastElem function
The GetLastElem function returns the final entry stored in a time series.
Syntax
GetLastElem(ts TimeSeries,
flags integer default 0)
returns row;
- ts
- The source time series.
- flags
- Valid values for the flags argument are described in The flags argument values. The default is
0
.
Description
The API equivalent of this function is ts_last_elem().
Returns
A row-type value containing the
time series data and time stamp of the last entry in the time series.
If the time series is empty, NULL
is returned. The
type of the row is the same as the time series subtype.
Example
The following query returns the final entry in a time
series:
select GetLastElem(stock_data)
from daily_stocks
where stock_name = 'HCLTECH';
The following query
retrieves the final entries on a daily stocks table:
select GetLastElem(stock_data) from daily_stocks;