Dear all,
I have come across this problem:
Database version: 8.1.7
Client: 9i
When I issue a query like below from the client:
select * from t
where date_col=to_date('2002/08/26','yyyy/mm/dd');
it returns no rows, although the records do exist.
The records only appear if I change query like this:
select * from t
where date_col>=to_date('2002/08/26','yyyy/mm/dd');
why is this so??? can someone explain this?
Is there any settings needed to be corrected?
Thanks in advance.
You're not respecting the time component of the date (ie. there are no records at midnight of your date). Try:
Code:
select * from t
where trunc(date_col)>=to_date('2002/08/26','yyyy/mm/dd');
One too many '>' characters in jeff's post. What he probbably realy ment was
Code:
select * from t
where trunc(date_col)= to_date('2002/08/26','yyyy/mm/dd');
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Hi both,
Thanks for your reply.
However, I tried your codes, it doesn't seem to be working, and I don't think 'time' here is the real issue. Since by using to_date(date_col,'yyyy/mm/dd'), the time should be eliminated from the query (although it's still exist).
Any new thoughts? Thanks.
Sorry both...your answer is actually working...
Thanks for your great help!!
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks