PutNthElem 函数

PutNthElem 函数在常规时间系列中的已提供偏移量处放置提供的行。

语法

PutNthElem(ts         TimeSeries, 
          row_value   row, 
          N          integer,
          flags      integer default 0) 
returns TimeSeries;
ts
要对其执行操作的时间系列。
row_value
存储在时间系列中的新行类型。
N
偏移量。必须大于等于 0。
flags
flags 参数值中描述了 flags 参数的有效值。缺省值为 0

描述

此函数类似于 PutElem,但 PutNthElem 采用偏移量而非时间戳记除外。

如果给定偏移量处存在数据,会更新为新数据;否则,会插入新数据。

传入的行类型必须符合时间系列的子类型。

无法更新隐藏的元素。

返回结果

包含新值的修改的时间系列。

示例

以下示例将数据放在 GBase 8s 时间系列的第一个元素中:
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 = 'GBase';