Tengo un problema, necesito hacer un consulta que me muestre todos los dias entre dos fechas, es decir si tengo 1/06/2009 y 30/06/2009 me debería mostrar todos los dias entre esas dos fechas. He intentado pero no me resulta, agradeceria su ayuda, saludos!
-- < Ora10g WITH dias as ( select '01' as dia from dual union select '02' as dia from dual union select '03' as dia from dual union select '04' as dia from dual union select '05' as dia from dual union select '06' as dia from dual union select '07' as dia from dual union select '08' as dia from dual union select '09' as dia from dual union select '10' as dia from dual union select '11' as dia from dual union select '12' as dia from dual union select '13' as dia from dual union select '14' as dia from dual union select '15' as dia from dual union select '16' as dia from dual union select '17' as dia from dual union select '18' as dia from dual union select '19' as dia from dual union select '20' as dia from dual union select '21' as dia from dual union select '22' as dia from dual union select '23' as dia from dual union select '24' as dia from dual union select '25' as dia from dual union select '26' as dia from dual union select '27' as dia from dual union select '28' as dia from dual union select '29' as dia from dual union select '30' as dia from dual union select '31' as dia from dual ) ,meses as ( select '01' as mes from dual union select '02' as mes from dual union select '03' as mes from dual union select '04' as mes from dual union select '05' as mes from dual union select '06' as mes from dual union select '07' as mes from dual union select '08' as mes from dual union select '09' as mes from dual union select '10' as mes from dual union select '11' as mes from dual union select '12' as mes from dual ) ,años as ( select '2000' as año from dual union select '2001' as año from dual union select '2002' as año from dual union select '2003' as año from dual union select '2004' as año from dual union select '2005' as año from dual union select '2006' as año from dual union select '2007' as año from dual union select '2008' as año from dual union select '2009' as año from dual union select '2010' as año from dual union select '2011' as año from dual union select '2012' as año from dual ) ,genera_fecha as ( select to_date(d.dia||m.mes||a.año,'DD/MM/YYYY') as fecha from dias d, meses m, años a WHERE to_number(d.dia) <= to_number(TO_CHAR(last_day(to_date(m.mes||a.año,'MMYYYY')),'DD')) ) select fecha from genera_fecha gfc WHERE fecha BETWEEN to_date('1/06/2009','DD/MM/YYYY') AND to_date('30/06/2009','DD/MM/YYYY') ORDER BY fecha -- -- -- -- >= Ora10g WITH genera_fecha as ( select fecha from dual MODEL DIMENSION BY (0 as i) MEasURES (CasT(NULL as DATE) as fecha) RULES UPSERT ITERATE (9000) ( fecha[iteration_number]=trunc(SYSDATE-iteration_number) ,fecha[iteration_number+9000]=trunc(SYSDATE+iteration_number) ) ) select fecha from genera_fecha gfc WHERE fecha BETWEEN to_date('1/06/2009','DD/MM/YYYY') AND to_date('30/06/2009','DD/MM/YYYY') ORDER BY fecha