PutSet function

The PutSet function updates a time series with the supplied multiset of row type values.

Syntax

PutSet(ts         TimeSeries, 
      multiset_ts set,
      flags       integer default 0) 
returns TimeSeries;
ts
The time series to act on.
multiset_ts
The multiset of new row type values to store in the time series.
flags
Valid values for the flags argument are described in The flags argument values. The default is 0.

Description

For each element in the multiset of rows, if the time stamp is NULL, the data is appended to the time series (for regular time series) or an error is raised (for irregular time series).

For regular time series, if there is data at a specified timepoint, it is updated with the new data; otherwise, the new data is inserted.

For irregular time series, if there is no data at a specified timepoint, the new data is inserted. If there is data at the specified timepoint, the following algorithm is used to determine where to place the data:
  1. Round the time stamp up to the next second.
  2. Search backward for the first element less than the new time stamp.
  3. Insert the new data at this time stamp plus 10 microseconds.

The row type that is 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 updates a time series with a multiset:
update activity_stocks
set activity_data = (select PutSet(activity_data, set_data)
            from activity_load_tab where stock_id = 600)
where stock_id = 600;