select a,b,c,d,
case when a = all(b,c,d) then 1 else 0 end as "all",
case when a != any(b,c,d) then 1 else 0 end as "any"
from (select 0 as a,0 as b,0 as c,0 as d from dual
union select 0,0,0,1 as d from dual
union select 0,0,1,0 as d from dual
union select 0,0,1,1 as d from dual
union select 0,1,0,0 as d from dual
union select 0,1,0,1 as d from dual
union select 0,1,1,0 as d from dual
union select 0,1,1,1 as d from dual
union select 1,0,0,0 as d from dual
union select 1,0,0,1 as d from dual
union select 1,0,1,0 as d from dual
union select 1,0,1,1 as d from dual
union select 1,1,0,0 as d from dual
union select 1,1,0,1 as d from dual
union select 1,1,1,0 as d from dual
union select 1,1,1,1 as d from dual);