Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How Do I Get a list of Days for a Given Month?
A copy of this was sent to "Shonte' N. Poe" <spoe2_at_isp.ford.com>
(if that email address didn't require changing)
On Fri, 23 Oct 1998 11:47:46 -0400, you wrote:
>I am trying to get a list of days for a month, given a specific date.
>
>For example, if I am given the date of '04-OCT-97',
>I want to get a list as follows:
>
>01-OCT-97
[snip]
>31-OCT-97
>
>
>The closest I have come is obtaining the start and end dates
>for the month:
>
>select
>ADD_MONTHS(LAST_DAY('04-OCT-97'),-1)+1 "First of Month"
>from dual
>
>union
>
>select
>LAST_DAY('04-OCT-97') "Last of Month"
>from dual
>;
>
>
>Please Help...
>Thanks...
All you need is a table with 31 or more rows (all_objects for example).... then a query like:
select to_date( '01-oct-1998', 'dd-mon-yyyy' ) + rownum-1
from all_objects
where rownum <=
to_number(to_char(last_day(to_date( '01-oct-1998', 'dd-mon-yyyy')), 'DD' )) /
will do it for you...
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
--
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Oct 23 1998 - 11:56:55 CDT
![]() |
![]() |