Hi,
Although this query returns 6 rows of data (2 rows having data, and rest of the rows are having NULL values), where as my requirement is to to get the following output:
RUN_SEQ | USAGE_PERIOD_START_DATE_D | USAGE_PERIOD_END_DATE_D |
1 | 01-Jan-13 | 30-Jan-13 |
2 | 31-Jan-13 | 01-Mar-13 |
3 | 02-Mar-13 | 31-Mar-13 |
4 | 01-Apr-13 | 30-Apr-13 |
5 | 01-May-13 | 30-May-13 |
6 | 31-May-13 | 29-Jun-13 |
select RUN_SEQ, USAGE_PERIOD_START_DATE_D, USAGE_PERIOD_END_DATE_D
from dual
model
dimension by (1 as idx)
MEASURES (
1 as RUN_SEQ,
TO_DATE('20130101','YYYYMMDD') AS USAGE_PERIOD_START_DATE_D,
TO_DATE('20130101','YYYYMMDD')+29 AS USAGE_PERIOD_END_DATE_D
)
rules upsert all (
RUN_SEQ[for idx from 2 to 6 increment 1] = RUN_SEQ[cv()-1]+1,
USAGE_PERIOD_START_DATE_D[for idx from 2 to 6 increment 1] = USAGE_PERIOD_END_DATE_D[cv()-1]+1,
USAGE_PERIOD_END_DATE_D[for idx from 2 to 6 increment 1] = USAGE_PERIOD_START_DATE_D[cv()]+29
)
order by idx;
Could anyone please suggest where am I going wrong.
Thanks & Regards,
Pawan