René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Generating dates with the model clause

select sysdate from dual;
SYSDATE
-------------------
14.09.2004 15:01:06
select dt from (select trunc(sysdate) dt from dual)
model 
  dimension by (0 d)
  measures     (dt)
  rules iterate(9) (
    dt[ iteration_number+1 ] = dt[ iteration_number ]+1
  );
DT
-------------------
14.09.2004 00:00:00
15.09.2004 00:00:00
16.09.2004 00:00:00
17.09.2004 00:00:00
18.09.2004 00:00:00
19.09.2004 00:00:00
20.09.2004 00:00:00
21.09.2004 00:00:00
22.09.2004 00:00:00
23.09.2004 00:00:00

Links