Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Analytics: Moving average

_AZ_Jul 17 2017 — edited Jul 21 2017

Hello,

I need to calculate a moving average ( for time-series data). For that i planned to use RANGE BETWEEN <calculation> PRECEDING AND CURRENT ROW clause in SUM(), but it appears that RANGE is not implemented.

Here is my futile attempt to get to use the RANGE clause:

select ts.*, sum(ts.p) over( partition by ts.reqid, ts.tick_type_id order by ts.ts_sec  RANGE BETWEEN TIMESTAMPADD(SQL_TSI_MINUTE, -p.param_value, ts.ts_sec) PRECEDING and CURRENT ROW) , TIMESTAMPADD(SQL_TSI_MINUTE, -p.param_value, ts.ts_sec)

from v_ticks_P_Sec ts, params p

where

        p.param_name = 'W1'

;

and running into the error:

TT0805: Analytical function window clause with logical offset has not been implemented

The v_ticks_P_Sec view has all columns as "number" datatype and ts_sec is a timestamp;

Appreciate your guidance

thank you

AZ

Message was edited by: _AZ_ Added desc of the view (v_ticks_P_Sec)

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 18 2017
Added on Jul 17 2017
7 comments
1,019 views