1 select 2 count(1) as cnt 3 from ( 4 select '0' as flag union all 5 select 'a' as flag union all 6 select null as flag 7 ) t0 8 where flag <> 0 9 ; 10 11 select 12 count(1) as cnt 13 from ( 14 select '0' as flag union all 15 select 'a' as flag union all 16 select null as flag 17 ) t0 18 where flag <> '0' 19 ; 20 21 select 22 count(1) as cnt 23 from ( 24 select '0' as flag union all 25 select 'a' as flag union all 26 select null as flag 27 ) t0 28 where nvl(flag,'') <> '0' 29 ;