Queries returning different result sets

Queries returning different result sets

 

  

Hi DBAs,

There are two queries here that our team expected the same result.
But when we run them, the results are different. The first result is the
correct one.


1 SELECT
2 count(*)
3 FROM valu_daily_unit_values_jt
4 WHERE jt_datetime >=
5 (select ended_datetime from valu_flow_status
6 where institution_id like 'NYSE' and as_of_date = '25-APR-2003')
7* and jt_operation != 'DEL'

COUNT(*)
----------
283441

SQL> r
1 SELECT
2 count(*)
3 FROM valu_daily_unit_values_jt
4 WHERE to_char(jt_datetime,'DD-MON-YYYY HH24:MI:SS') >=
5 (select to_char(ended_datetime,'DD-MON-YYYY HH24:MI:SS') from
valu_flow_status
6 where institution_id like 'NYSE' and as_of_date = '25-APR-2003')
7* and jt_operation != 'DEL'

COUNT(*)
----------
1095276

What we think are the date format and to_char function. But what is the
explanation?
Pls advise. Thanks in advance.

Jeremy




_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail

Oracle LazyDBA home page