SQL Modeling - Cummulative Sum of Numbers

SELECT val, fs running_total  FROM DUAL
 MODEL RETURN ALL ROWS
 DIMENSION BY ( 0 d )
 MEASURES (0 fs, 0 val)
 RULES ITERATE (10)
 (fs[iteration_number] = DECODE(iteration_number, 0,1,
     NVL(fs[iteration_number],1)+fs[iteration_number-1])+NVL(iteration_number,0),
  val[iteration_number] = iteration_number+1)
;



Oracle registered trademark of Oracle Corporation.

Last Revised On: November 08, 2013

  1386