there is a table INCASSO in my database:
CREATE TABLE \"GEC_AP\".\"INCASSO\"
(\"ID_INCASSO\" VARCHAR2(50 BYTE) NOT NULL ENABLE,
\"ID_FATTURA\" VARCHAR2(50
Change the date format to DD-MON-YYYY HH24:MI:SS
and you are likely to see the difference in that the dates have different centuries.
Using RR
to format the year can hide that one date is 1911
and the other is 2011
Try:
SELECT TO_CHAR( DATE '2011-01-01', 'RR-MM-DD' ),
TO_CHAR( DATE '1911-01-01', 'RR-MM-DD' )
FROM DUAL
Both will output the same although they are different dates and will not be grouped together.
If the dates are still the same then look for additional spaces or other hidden characters in the strings; you can use LENGTH()
to check the size of the strings or DUMP()
to get the byte values of the contents:
select id_incasso,
id_fattura,
LENGTH( id_fattura ) AS f_length,
id_piano_rate,
LENGTH( id_piano_rate ) AS pr_length,
TO_CHAR( data_esecuzione, 'YYYY-MM-DD HH24:MI:SS' ) AS data_esecuzione
from incasso
where id_incasso = 'TO_20110521258225'
I've changed the date format used in SQL Developer to DD-MON-YYYY HH24:MI:SS and the following query:
select id_incasso, id_fattura, id_piano_rate, data_esecuzione from incasso where id_incasso = 'TO_20110521258225'
show that the difference is in the year:
Thanks everyone.