I wonder if NVARCHAR2 (1) and VARCHAR2 (1) act differently with respect to null / empty?
From testing, it seems like.
You can get some surprises.
i.e. comparing an empty string in! = 'Y' will not return empty string lines. those. an empty string does not have and is not equal to "Y" ...
need nvl wrapper function
e.g. nvl (top (WP. "OW_IS_MISRUN"), 'N')! = 'Y'
select count - (*) from "DATA_HUB". "OW_WELL_PERFORATION" WP where WP.UWI = 17038046
7
select count (*) from "DATA_HUB". "OW_WELL_PERFORATION" WP where WP.UWI = 17038046 and top (WP. "OW_IS_MISRUN")! = 'Y'
one
select count (*) from "DATA_HUB". "OW_WELL_PERFORATION" WP where WP.UWI = 17038046 and top (WP. "OW_IS_MISRUN") = 'Y'
2
select count (*) from "DATA_HUB". "OW_WELL_PERFORATION" WP where WP.UWI = 17038046 and nvl (upper (WP. "OW_IS_MISRUN"), 'N')! = 'Y'
5
Allan F Nov 16 '17 at 0:37 2017-11-16 00:37
source share