PutNthElem function

The PutNthElem function puts the supplied row at the supplied offset in a regular time series.

Syntax

PutNthElem(ts         TimeSeries, 
          row_value   row, 
          N          integer,
          flags      integer default 0) 
returns TimeSeries;
ts
The time series to act on.
row_value
The new row type value to store in the time series.
N
The offset. Must be greater than or equal to 0.
flags
Valid values for the flags argument are described in The flags argument values. The default is 0.

Description

This function is similar to PutElem, except PutNthElem takes an offset instead of a time stamp.

If there is data at the given offset, it is updated with the new data; otherwise, the new data is inserted.

The row type passed in must match the subtype of the time series.

Hidden elements cannot be updated.

Returns

A modified time series that includes the new values.

Example

The following example puts data in the first element of the IBM® time series:
update daily_stocks
set stock_data =
    PutNthElem(stock_data,
   row(NULL::datetime year to fraction(5), 355, 309, 
   341, 999)::stock_bar, 0)
where stock_name = 'IBM';