clear markdown feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3364508 fiddles created (36281 in the last week).

create table t (a, b) as select 'A', 3 from dual union all select 'B', 7 from dual union all select 'C', 6 from dual union all select 'D', 5 from dual union all select 'E', 9 from dual union all select 'F', 3 from dual union all select 'G', 8 from dual;
7 rows affected
 hidden batch(es)


with sorted (a, sort, b, running_sum_max_15) as ( select a, row_number() over (order by a), b, 0 from t) select a, b, running_sum_max_15 from sorted model dimension by (sort) measures (a, b, running_sum_max_15) rules update ( running_sum_max_15[1] = b[1], running_sum_max_15[sort>1] = case when running_sum_max_15[CV(sort)-1] < 15 then running_sum_max_15[CV(sort)-1] else 0 end + b[CV(sort)] )
A B RUNNING_SUM_MAX_15
A 3 3
B 7 10
C 6 16
D 5 5
E 9 14
F 3 17
G 8 8
 hidden batch(es)