oracle sql查询时间段内的具体日期
select to_char(to_date(20110901, 'YYYYMMDD') + (lv - 1), 'YYYYMMDD') time_id,
(case when 'month'='week' then to_char(to_date(20110901, 'YYYYMMDD') + (lv - 1), 'day')||' ('||to_char(to_date(20110901, 'YYYYMMDD') + (lv - 1), 'YYYY-MM-DD')||')'
else to_char(to_date(20110901, 'YYYYMMDD') + (lv - 1), 'YYYY-MM-DD') end ) time_name
from (select level lv from dual
connect by level <= to_date(20111001, 'YYYYMMDD') - to_date(20110901, 'YYYYMMDD'))
select to_char(to_date(20110901, 'YYYYMMDD') + (lv - 1), 'YYYYMMDD') time_id,
(case when 'month'='week' then to_char(to_date(20110901, 'YYYYMMDD') + (lv - 1), 'day')||' ('||to_char(to_date(20110901, 'YYYYMMDD') + (lv - 1), 'YYYY-MM-DD')||')'
else to_char(to_date(20110901, 'YYYYMMDD') + (lv - 1), 'YYYY-MM-DD') end ) time_name
from (select level lv from dual
connect by level <= to_date(20111001, 'YYYYMMDD') - to_date(20110901, 'YYYYMMDD'))