I have several different types of data related to a date range that I want to combine together, but at the same time broken day. Thus, the three-day piece of data will result in three lines:
start primary_key start+1 primary_key start+2 primary_key
I played using the model suggestion in a select statement in 10g and was looking for the best way to achieve this. I am currently joining a date range that covers the entire range of possible dates (select min (start date), max (end date)). I would prefer to select data and add more rows to them to convert them to a dataset for the day.
edit:
I managed to come up with (now there are sample data):
SELECT * FROM ( SELECT 123 req_code, 345 req_par_code, TO_DATE('01-03-2010', 'dd-mm-yyyy') req_start_date, TO_DATE('05-03-2010', 'dd-mm-yyyy') req_end_date FROM dual ) MODEL PARTITION BY (req_code) DIMENSION BY (0 d) MEASURES (SYSDATE dt, req_par_code, req_start_date, req_end_date) RULES ITERATE(365) UNTIL (dt[iteration_number] >= TRUNC(req_end_date[0])) ( dt[iteration_number] = NVL(dt[iteration_number-1] + 1, TRUNC(req_start_date[0])),
Chris source share