Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: LIKE Clause with dates?
> MADEIRA SALLY wrote:
> I have a procedure with paramaters of Procedure GetParticipations(AsOfDate
IN DATE)
> The date is usually the last date of the month.
> I would like to create a LIKe Clause so that my WHERE statement specifies
all records
> WHERE DatePart LIKE '3'..%..'99'
> The AsOfDate being '3/31/1999' How would that be accomplished!
> Thanks in Advance
> Sally
> Actually AsofDate is 3/31/99 so what I need is any date that falls in
between 3/1/99 and 3/31/99
> but I do not want the users to enter to paramenter values just one so it
would be LIKE '3/%/99'
SUGGESTION from : (performance rate)
analog test:
select count(*) from atable where datepart between trunc(AsOfDate,'mm') and
last_day(AsOfDate)
result :1729 of 9696 recs / 0.02 sec !!! EXCELLENT
analog test:
select count(*) from atable where to_char(datepart,'MM/DD/YYYY') like
'04/'||'%'||'/1999'
result :1729 of 9696 recs / 0.44 sec
analog test:
select count(*) from atable where trunc(AsOfDate ,'MM')=trunc(datepart,'MM')
result :1729 of 9696 recs / 0.5 sec
analog test:
select count(*) from atable where AsOfDate between trunc(datepart,'mm') and
add_months(trunc(datepart,'mm'),1)
result :1729 of 9696 recs / 0.7 sec
![]() |
![]() |