GetFirstElem function

The GetFirstElem function returns the first element in a time series.

Syntax

GetFirstElem(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_first_elem().

Returns

A row type containing the first element of the time series, or NULL if there are no elements. The type of the row is the same as the time series subtype.

Example

The following example gets the first element in the time series for the stock with ID 600:
select GetFirstElem(activity_data)
   from activity_stocks
   where stock_id = 600;