Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: All Dates
In article <39D34C58.D48F0B62_at_bt.com>,
trevor burkin <trevor.2.burkin_at_bt.com> wrote:
> Mark,
>
> My code lists all the dates between 2 dates with no duplication.
>
> Your code would only act as a filter on a date field - listing all
rows
> from table where date field between &1 and &2.
>
> I read the original question differently to you I think?
>
> Regards
> Trevor
>
> Mark D Powell wrote:
>
> > In article <39D1EE2F.9706EB5D_at_bt.com>,
> > trevor burkin <trevor.2.burkin_at_bt.com> wrote:
> > > Hope this helps
> > >
> > > select to_date('&1','ddmmyyyy') + rownum - 1
> > > from table_with_more_rows_than_dates_required
> > > where rownum <= to_date('&2','ddmmyyyy') - to_date
('&1','ddmmyyyy') +
1
> > >
> > > Regards Trevor
> > >
> > > Ganesh R wrote:
> > >
> > > > Hi,
> > > >
> > > > I want to fetch all the dates btw. to given dates. This can be
achived
> > > > thru PL?SQL but i want to get it thru a Select Statement.
> > > >
> > > > Any Help
> > > >
> > > > Regards,
> > > > Ganesh R
> > > >
> > It looks like Trevor pulled his answer from code intended to solve a
> > more complex problem. All you need is to use the between clause or
> > a combination of >= and <.
> >
> > where date_col between to_date('start','Format') and
> > to_date('End','Format')
> >
> > Or
> >
> > where date_col >= to_date('start','Format')
> > and date_col < to_date('end','Format')
> >
> > --
> > Mark D. Powell -- The only advice that counts is the advice that
> > you follow so follow your own advice --
> >
Trevor, you are probably correct. It depends if he want the actual
dates themselves for which your code works or he wants the rows
associated with the date values, but a third reading makes me think you
aswered the right question.
-- Mark D. Powell -- The only advice that counts is the advice that you follow so follow your own advice -- Sent via Deja.com http://www.deja.com/ Before you buy.Received on Fri Sep 29 2000 - 13:00:16 CDT
![]() |
![]() |