I'm on an Oracle database, the following query:
select codi_belf, data_elab,id_inte,anno from mimsspam_tab where id_inte = 504;
retrieves 6 records
E924 05-AGO-15 504 2015 D458 05-AGO-15 504 2015 D458 05-AGO-15 504 2015 B275 05-AGO-15 504 2015 E924 05-AGO-15 504 2015 B275 05-AGO-15 504 2015
where "data_elab" is a field of type DATE and AGO is just the Italian locale for AUG.
I try to filter by date like this:
select codi_belf, data_elab,id_inte,anno
from mimsspam_tab where id_inte = 504
and data_elab = TO_DATE('05/08/2015','dd/MM/yyyy');
And I get NO results..
Moreover if I filter this way:
select codi_belf, data_elab,id_inte,anno
from mimsspam_tab where id_inte = 504
and TO_CHAR(data_elab,'dd/MM/yyyy')='05/08/2015';
I got my six records back!
Shouldn't the two ways of filtering be equivalent? Why they aren't? And why the first eats all my six records? Could this depend on a weird configuration of the oracle installation I'm querying to?