Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: date comparison
Raj schrieb:
> I need to compare two dates...one stored in a table and the other user
> generated.
> The table column time is of the format 08/03/2006 07:31.
A date stored in the database is always in internal date format. It does not matter how it is put into. You do have defined the column as date?
> The user generated time is 2006/03/08.
> I am currently comparing them like this:
> ...
> WHERE to_date(to_char(time, 'yyyy/mm/dd'), 'yyyy/mm/dd') =
> to_date('2006/03/08', 'yyyy/mm/dd')
> ...
If time is a date-field use this one:
where time = to_date(<userinput>, 'yyyy/mm/dd')
if time is not a date-field change it.
> This doesn't look very efficient to me though. Can anyone please advise?
It is not very efficient indeed...
hth,
Moritz Received on Wed Mar 08 2006 - 08:32:01 CST
![]() |
![]() |