Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: sysdate
Arjan van Bentem wrote
>Marc Mazerolle wrote
>> Why trunc sysdate at all in a between or in a <= condition ?
>
>If you don't use trunc(..), like
>
> select abc
> from xyz
> where activitydate>=sysdate
> and activitydate < (sysdate+1)
>
>then at 21:12 you'd only select activity dates between today, 9:12
p.m. and
>tomorrow, 9:12 p.m. I doubt that is what anyone would ever need....
>
>Arjan.
>
Yes, you probably should use TRUNC. Remember that even though dates
in Oracle look like just plain old dates, internally they are
represented as a
real number and encodes time as well as the date into a date field.
The
trunc strips off the fractional values that represent the time to
effectively
convert the date field to a time of midnight. Play with TO_CHAR with
a format of hh24:mi:ss among other things to look at the time that is
encoded with the date.
...Ru Received on Wed Mar 31 1999 - 00:00:00 CST
![]() |
![]() |