Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: LIKE Clause with dates?

Re: LIKE Clause with dates?

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Tue, 22 Jun 1999 21:08:16 +0800
Message-ID: <376F8AC0.157D@yahoo.com>


James Lorenzen wrote:
>
> 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.

or maybe...

where AsOfDate between trunc(datepart,'mm') and

                        add_months(trunc(datepart,'mm'),1)

which CAN use the indexes...
--



Connor McDonald
"These views mine, no-one elses etc etc" connor_mcdonald_at_yahoo.com

"Some days you're the pigeon, and some days you're the statue." Received on Tue Jun 22 1999 - 08:08:16 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US