Re: Search between date ranges

From: Shakespeare <whatsin_at_xs4all.nl>
Date: Wed, 30 Jul 2008 14:19:02 +0200
Message-ID: <48905c36$0$49958$e4fe514c@news.xs4all.nl>

"Chris" <christophercash_at_hotmail.com> schreef in bericht news:73b00095-9ba4-4c9c-aa57-3a5e7636d893_at_56g2000hsm.googlegroups.com...
> Hi Guys,
>
> I am trying to bild a cursor based on a select statement which returns
> values between a certain date range. I have read that it is best
> avoiding the BETWEEN function of SQL.
>
> Instead I hav written :
>
> AND ol.actual_shipment_date >= p_date_from
> AND ol.actual_shipment_date <= (p_date_to)
>
> If I have the p_date_from parameter set to 01-JAN-08 and the p_date_to
> parameter set to 10-JAN-08 it will only return dates from 01-JAN to 09-
> JAN (not the 10th)
>
> To overcome this I have written :
>
> AND ol.actual_shipment_date >= p_date_from
> AND ol.actual_shipment_date <= (p_date_to +1)
>
> This seems a very crude way of doing it and was wondering if there is
> an easier way?
>
> Thanks in advance,
> Chris

I guess you have to TRUNC your dates at both sides (trunc(date1) <= trunc(date2))

Shakespeare Received on Wed Jul 30 2008 - 07:19:02 CDT

Original text of this message