Home » SQL & PL/SQL » SQL & PL/SQL » Date Comparison using to_date
Date Comparison using to_date [message #270078] Tue, 25 September 2007 11:21 Go to next message
thapa
Messages: 15
Registered: September 2007
Junior Member
Hi

In my table I have created_date column which is of type Date.
I want to retrieve all the data with created_date AFTER the given date( 1948/10/10 19:00:00).
I do
select * from XXX where created_date > to_date('1948.10.10 19:00:00','YYYY.MM.DD HH24:MI:SS'). This works great!

But Now I want to retrieve all data created BEFORE before the given date( 1948/10/10 19:00:00).I simply reverse the > sign to < but this time I get No(Zero) results (with query running just fine) !!!.. I have verified the existence of data with created_date before 1948.

Am I doing some fundamental mistakes? I tried with BETWEEN... AND and still 0 results.

Someone please advice. Thanks in advance

Kris.
Re: Date Comparison using to_date [message #270080 is a reply to message #270078] Tue, 25 September 2007 11:32 Go to previous messageGo to next message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
Quote:
Am I doing some fundamental mistakes?
No.
Quote:
I tried with BETWEEN... AND and still 0 results.
How did you do that? what is the date you have passed after BETWEEN?

Anyway, you can cross check using the following code, if you still have doubt
select to_char(min(creation_date),'YYYY.MM.DD HH24:MI:SS')
  from XXX;
By
Vamsi
Re: Date Comparison using to_date [message #270157 is a reply to message #270078] Tue, 25 September 2007 23:44 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
date_created before 1948?!
Was that done using Oracle R0.1? Wink
Previous Topic: Select query
Next Topic: Unique Key when Not null behaves same as Priamary Key....Then what is difference.
Goto Forum:
  


Current Time: Fri Dec 02 23:10:40 CST 2016

Total time taken to generate the page: 0.11055 seconds