Oracle SQL Modeling - Monthly Growth Query
This is an example of SQL modeling to compute ROI for 12 months. The monthly interest and principal are computed using the SQL MODEL iteration syntax (for principal of 1000 at 5.00% APR).

SQL Modeling - Monthly Growth
SELECT val month, ROUND(pr,3) principal, ROUND(fval,3) "GROWTH_5%_APR"  FROM DUAL
 MODEL RETURN ALL ROWS
 DIMENSION BY ( 0 d )
 MEASURES (0 fval, 0 val, 0 pr)
 RULES ITERATE (12)
 (fval[iteration_number] = DECODE(iteration_number, 0,1000+1000*0.05/12,
                             fval[iteration_number-1]+fval[iteration_number-1]*0.05/12),
    pr[iteration_number] = DECODE(iteration_number, 0,1000,
                             pr[iteration_number-1]+pr[iteration_number-1]*0.05/12),
   val[iteration_number] = iteration_number+1)
;



Oracle registered trademark of Oracle Corporation.

Last Revised On: November 08, 2013

  1258