InsElem function
The InsElem function inserts an element into a time series.
Syntax
InsElem(ts TimeSeries,
row_value row,
flags integer default 0)
returns TimeSeries;
- ts
- The time series to act on.
- row_value
- The row type value to be added to the time series.
- flags
- Valid values for the flags argument are described
in The flags argument values. The default
is
0
.
Description
The element must be a row type of the correct type for the time series, beginning with a valid time stamp. If there is already an element with that time stamp in the time series, the insertion is void, and an error is raised. After the insertion is done, the time series must be assigned to a row in a table, or the insertion is lost.
InsElem should be used only within UPDATE and INSERT statements. If it is used within a SELECT statement or a qualification, unpredictable results can occur.
You cannot insert an element at a time stamp that is hidden.
The API equivalent of InsElem is ts_ins_elem().
Returns
The new time series with the element inserted.
Example
The following example inserts an
element into a time series:
update activity_stocks
set activity_data =
InsElem(activity_data,
row('2011-10-06 08:06:56.00000', 6.50, 2000,
1, 007, 3, 1)::stock_trade)
where stock_id = 600;