DB interaction SQL

I am working on a JDBC program for which I am writing a query, now I know its not a SQL forum but I am hoping that somebody would be kind enough to put in a word or two.

Now when I run the following query

SELECT Count(*)

FROM ptedb.mon m, epay_msg.status st

WHERE to_char(m.pDATE,'DD-Mon-YY') >=to_char(st.tDATE,'DD-Mon-YY')

AND m.tdate > SYSDATE-7

however whn I run

SELECT Count(*)

FROM ptedb.mon m, epay_msg.status st

WHERE to_char(m.pDATE,'DD-Mon-YY') >=to_char(st.tDATE,'DD-Mon-YY')

it returns 7 results

and when I run

SELECT Count(*)

FROM ptedb.mon m, epay_msg.status st

WHERE m.tdate > SYSDATE-7

this also returns some results. So considering that I should get some no with the first query as well. Its really confusing me please advise.

[965 byte] By [LisaMa] at [2007-11-26 17:51:14]
# 1
Does that to_char function you have there format a date into a string that looks like "23-Nov-06"? And are you then comparing that to another string that looks like "16-Dec-06"? (Just for example.)And do you expect 16-Dec-06 to be less than, or greater than, 23-Nov-06?
DrClapa at 2007-7-9 5:03:43 > top of Java-index,Java Essentials,Java Programming...
# 2
as long as there is no overlap between the results from both smaller queries, the first one won't yield any result...
jwentinga at 2007-7-9 5:03:43 > top of Java-index,Java Essentials,Java Programming...
# 3
SELECT Count(*)FROM ptedb.mon m, epay_msg.status stWHERE m.pDATE >= st.tDATEAND m.tdate > SYSDATE-7
kilyasa at 2007-7-9 5:03:44 > top of Java-index,Java Essentials,Java Programming...