1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| select a,b
,case when a=b then 'true' when not ( a=b ) then 'false' else 'null' end "a=b"
,case when a=b or a is null and b is null then 'true' when not ( a=b or a is null and b is null ) then 'false' else 'null' end "a=b or a is null and b is null"
,case when a=b or a is null or b is null then 'true' when not ( a=b or a is null or b is null ) then 'false' else 'null' end "a=b or a is null or b is null"
,case when not lnnvl(a=b) then 'true' when not ( not ( lnnvl(a=b) ) ) then 'false' else 'null' end "not lnnvl(a=b)"
,case when nvl(a,cast('NaN' as binary_double))=nvl(b,cast('NaN' as binary_double)) then 'true' when not ( nvl(a,cast('NaN' as binary_double)) =nvl(b,cast('NaN' as binary_double)) ) then 'false' else 'null' end "nvl(a,NaN)=nvl(b,NaN)"
,case when sys_op_map_nonnull(a)=sys_op_map_nonnull(b) then 'true' when not (sys_op_map_nonnull(a)=sys_op_map_nonnull(b)) then 'false' else 'null' end "sys_op_map_nonnull"
from (
select 1 a,1 b from dual union all select null,null from dual union all select 1,null from dual union all select 1,2 from dual
)
/
A B a=b a=b or a is null and b is null a=b or a is null or b is null not lnnvl(a=b) nvl(a,NaN)=nvl(b,NaN) sys_op_map_nonnull
- - ----- ------------------------------ ----------------------------- -------------- --------------------- ------------------
1 1 true true true true true true
null true true false true true
1 null null true false false false
1 2 false false false false false false |
Partager