Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: These WHERE clause are equal ?
Yes and no. Depends on your data. And, of course, my assumption that what
you posted is not what you actually ran as your CASE2 is definitely missing
a few things ... starting with the word "WHERE".
PS: The WHERE clause in Case1 should have TO_DATE added to it. What you have may work ... but Oracle does not guarantee it will work.
Daniel Morgan
R Chin wrote:
> Are the WHERE clauses below equivalent ?
>
> stamp_date has time stamp (ie '02/08/2002 12:57:51 PM')
> and I don't care about the time.
>
> Case 1)
> select * from TBL_LOG
> where TRUNC(stamp_date) BETWEEN '04-FEB-2002' AND '09-FEB-2002'
>
> Case 2)
> select * from TBL_LOG
> stamp_date BETWEEN TO_DATE('04-FEB-2002') AND TO_DATE('09-FEB-2002') +
> .99999
>
> rowid comparison seems to match.
>
> Thanks
Received on Tue Feb 26 2002 - 15:13:32 CST