Number of days for all the months of the previous 10 years

Hi guys,.
I wonder if there is a way to insert in my table of data for the period dimension all
days for the months of the year 2004,2005,2006,2007, etc..
Is there somewhere in the Oracle database that stored the number of days for all the months of the years?
I think I woud have to use a loop of the GET something like the following:

-The year month day
2004 - 1-1
2004 1-2
2004 1-3
2004 1-4
2004 1-5
2004 1-6
etc.
Assuming that there are 28 or 29 or 30 or 31 days the lines for January 2004 would be 28,29,30 or 31.
I need it for all the months and years.
Thank you
metalray

Hello

The following SQL returns all the days from 01/01/1970 until today:
+ (Just modify the FRST to What You Need).

with beginat as (
select trunc(to_date('1970/01/01','yyyy/mm/dd')) frst from dual
)
select frst+(level-1) as daydt
from beginat
connect by level <= ceil(sysdate-frst);

With a previous alter session set nls_date_format = "dd/mm/yyyy hh24:mi:ss" result would be:

DAYDT
-------------------
01/01/1970 00:00:00
02/01/1970 00:00:00
03/01/1970 00:00:00
04/01/1970 00:00:00
05/01/1970 00:00:00
06/01/1970 00:00:00
(...)
09/01/2011 00:00:00
10/01/2011 00:00:00
11/01/2011 00:00:00

14986 rows selected.

In fact, the real question is: Why do you need them?
(^_^)

Published by: Nicosa January 11, 2011 14:25
(for the correction)

Tags: Database

Similar Questions

Maybe you are looking for