I want to expand a range using DB2(on iSeries) query. For example, I have the following value in a table
2016-10-01 2016-10-03 600
I want the output as
2016-10-01 200 
2016-10-02 200
2016-10-03 200
I tried but I am not able to develop the query. It should be somewhere in similar lines as below.
Table (MYTABLE) has two columns. Below is snapshot
START_DT    END_DT    
2016-01-01  2016-01-03
On this query
with temp1 as                                 
(                                             
  SELECT start_dt, end_dt, start_dt as dt     
  FROM mytable                                
    UNION                                     
  SELECT start_dt, end_dt, dt + 1 day as dt   
  FROM temp1                                  
  WHERE dt < end_dt                           
)                                             
SELECT dt                                     
FROM temp1    
I am getting the error "Column list not valid for table".
I tried this as well
with temp1 (start_dt, end_dt, dt) as             
(                                                
  SELECT start_dt, end_dt, start_dt as dt        
  FROM mytable                                   
    UNION                                        
  SELECT start_dt, end_dt, dt + 1 day as dt      
  FROM temp1                                     
  WHERE dt < end_dt                              
)                                                
SELECT dt                                        
FROM temp1  
This is throwing error "Keyword not allowed in recursive common table expression TEMP1."
                        
I did a test -- this works on 9.7
original answer
Here you go:
If start_dt and end_dt are type date and not timestamp use: