Data Compare bug: Null is not Zero

Roeland

Member³
When Comparing Data, a Number field that has a 0 or a null value is treaded the same.

Example code:
Source DB

SQL:
create table Test_Data_Compare
(id number not null,
 Text varchar2(10 char) null,
 Amount number null);
alter table TEST_DATA_COMPARE
  add constraint TEST_DATA_COMPARE_PK primary key (ID);

INSERT INTO TEST_DATA_COMPARE T (ID, TEXT, AMOUNT)
  VALUES (1, '0', 5);
INSERT INTO TEST_DATA_COMPARE T (ID, TEXT, AMOUNT)
  VALUES (2, ' ', 5);
INSERT INTO TEST_DATA_COMPARE T (ID, TEXT, AMOUNT)
  VALUES (3, null, 5);
INSERT INTO TEST_DATA_COMPARE T (ID, TEXT, AMOUNT)
  VALUES (4, 'Test', '0');
INSERT INTO TEST_DATA_COMPARE T (ID, TEXT, AMOUNT)
  VALUES (5, 'Test', null);
COMMIT;

Target DB: Execute Previous SQL +

SQL:
update TEST_DATA_COMPARE t
   set t.text = null
 where t.id = 1;
update TEST_DATA_COMPARE t
   set t.text = null
 where t.id = 2;
update TEST_DATA_COMPARE t
   set t.text = '0'
 where t.id = 3;
update TEST_DATA_COMPARE t
   set t.amount = null
 where t.id = 4;
update TEST_DATA_COMPARE t
   set t.amount = 0
 where t.id = 5;
COMMIT;

Now perform a Compare Table Data against these 2 tables.
Result:

SQL:
UPDATE TEST_DATA_COMPARE T SET TEXT = '0'
  WHERE ID = 1;
UPDATE TEST_DATA_COMPARE T SET TEXT = ' '
  WHERE ID = 2;
UPDATE TEST_DATA_COMPARE T SET TEXT = NULL
  WHERE ID = 3;
COMMIT;

For Varchar2 fields the compare works. Alas this is not the case for Numbers...

Roeland

PL/SQL Developer 8.0.4.1514
PL/SQL Developer 9.0.0.1600
 
Back
Top