Oracle date seems equal

I have an INCASSO table in my database:

CREATE TABLE "GEC_AP"."INCASSO" 
("ID_INCASSO" VARCHAR2(50 BYTE) NOT NULL ENABLE,
 "ID_FATTURA" VARCHAR2(50 BYTE) NOT NULL ENABLE, 
 "ID_PIANO_RATE" VARCHAR2(22 BYTE) DEFAULT -1 NOT NULL ENABLE,
 "DATA_ESECUZIONE" DATE DEFAULT SYSDATE NOT NULL ENABLE,
 ...)

The primary key includes four fields:

CONSTRAINT "PK_INCASSO" PRIMARY KEY ("ID_INCASSO", "ID_FATTURA", "ID_PIANO_RATE", "DATA_ESECUZIONE")

There seems to be a duplicate entry when I run the following query:

select id_incasso, id_fattura, id_piano_rate, data_esecuzione
from incasso
where id_incasso = 'TO_20110521258225'

enter image description here

But with another query, 0 records are retrieved:

select id_incasso, id_fattura, id_piano_rate, data_esecuzione, count(*)
from incasso where id_incasso = 'TO_20110521258225'
group by id_incasso, id_fattura, id_piano_rate, data_esecuzione
having count(*) > 1

The database is on Oracle 11.2.0.1.0, and I am using SQL Developer 4.1.1.19.

In SQL Developer, the date format is:

enter image description here

I would like to know if the entries are different or there is a problem with the date in the editor. If entries differ by date, in what part of the date do they differ? If this is a format date issue in the editor, how can I fix it?

+4
source share
2 answers

DD-MON-YYYY HH24:MI:SS, , , , .

RR , 1911, - 2011

Try:

SELECT TO_CHAR( DATE '2011-01-01', 'RR-MM-DD' ),
       TO_CHAR( DATE '1911-01-01', 'RR-MM-DD' )
FROM   DUAL

, .

, ; LENGTH(), DUMP(), :

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'
+2

, SQL Developer DD-MON-YYYY HH24: MI: SS :

select id_incasso, id_fattura, id_piano_rate, data_esecuzione from incasso where id_incasso = 'TO_20110521258225'

, : in the year

.

0

Source: https://habr.com/ru/post/1666371/


All Articles