Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL date query problem with century/ year

NuenhundretfunfundsiebzigMar 15 2013 — edited Mar 18 2013
We have an oracle database with about 6 million records. There is a date field called Entered Date that ranges from 1985 to the present.
The majority of these records were entered prior to Jan 1 2000.
If I run a query like
select count(*) from (tablename) where entered_date < '01-JAN-00' I get 0
if I do
select count(*) from (tablename) where entered_date < '31-DEC-99' I get 0
BUT IF I DO
select count(*) from (tablename) where entered_date < '01-JAN-00' I get 6 million records
or
select count(*) from TREASURY.ctrc where entrydate > '31-DEC-99' I get 6 million records

I've tried the same queries using 4 digit years but get the same results; it thinks that 2000 is the less than 1999
How do I get around this?
thanks
This post has been answered by Frank Kulash on Mar 15 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 15 2013
Added on Mar 15 2013
14 comments
4,054 views