Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: LIKE Clause with dates?
A bit of elaboration on the TRUNC() function. If the query is looking
for all of the dates in March 1999, then the query could be written as:
….
WHERE TRUNC(AsOfDate,'mm') = TRUNC(DatePart,'mm')
This will truncate both dates, "AsOfDate" and "DatePart" to the first of the month and the WHERE clause can be satisfied with an equal condition. (This will not use any index that may be on the DatePart column).
HTH
James
In article <376F94E9.AC62C527_at_wcom.com>,
Steven Franklin <steven.franklin_at_wcom.com> wrote:
> use TRUNC()
>
> 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
>
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Tue Jun 22 1999 - 12:39:35 CDT