Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: dates
Not to quibble too much, but Thomas forgot to close parens on the TO_DATE
function...
In addition, depending on when (as in 'time of day') you need to make your comparison, you might want to look at :
WHERE TRUNC( initial_date) < TO_DATE( '01-Jan-99', 'dd-Mon-yy')
(etc.) Trunc will look at ONLY the 'day' portion of 'initial_date', so that only rows with 'initial_date' DAYS > 01-Jan-99 will answer. Otherwise you may get unexpected results when you see that you have some dates that appear to be '01-Jan-99', because 'initial_date' may have been stored with a time element you weren't aware of. (For instance, if 'initial_date' is stored as 'sysdate' at record creation, for instance, and not a user-entered day-only date.)
Chris
Thomas Bierhance wrote in message <375587AE.1F33C742_at_orbital-computer.de>...
>> select * from table where initial_date < '01-Jan-99' and final_date >
>> '01-Jan-99';
>>
>
>try the to_date function: to_date ('01-Jan-99', 'dd-mon-yy'
>
>
Received on Sat Jun 05 1999 - 22:33:08 CDT