Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL date inquiry
A date field isn't a character string you have been using it.
I don't have all the rules for type conversion in my head, but that's what has to hapen when you compare a date with a string.
Appearently the like operator is forcing the conversion where the = doesn't.
select mydate form mytable where mydate=to_date('25-aug-98')
If your date columns contain time, the above comparision will fail.
Time defaults to 12:00am for dates. If you have time, then you need to check for the date being between date=> and <date +1.
I've got a nasty looking algorythem that works. It converts date to char adds 1, then converts back to date to do the arithmatic. I'd love to see a simpler solution.
Paul Newcomb <pen_at_swl.msd.ray.com> wrote:
> Can someone explain this : a select for a date field such as "=
> '25-AUG-98' " returns no rows, but changing the "=" to "like" does
> return the desired rows...I realize that date fields also include time
> information, but I'm wondering why "like" works without the usual "%"
> wildcard.
>
--
joebrown
@leading.net
Received on Wed Sep 16 1998 - 11:05:04 CDT
![]() |
![]() |