I have to compare two tables with identical structure (int not null,int not null, varchar2). In both tables field3
is a nullable.
I have the next SQL:
Select
t1.field1, t1.field2, t1.field3)
From
table1 t1
Where (field1,field2,field3)
not in
(select field1,
field2,field3
from table2 t2)
When the field3 is NULL in any of them (t1 or t2) the query does not return any row. For instance I want to return a row from this data but it returns nothing at all.
Table 1
field1 field2 field3
1 2 <NULL>
Table 2
field1 field2 field3
1 2 'some text data'
There is workaround to fix such thing by using the NVL function: NVL(field3, 'dummytextorwhatever')
but I dont want to include such horrible thing into my code. Any idea to solve this problem with nullable fields?
Thank you!