Here is the solution
select decode(
count(1),
sum(decode(comm,null,0,1)),
sum(comm),
null) comm_total
from emp;
here is the process behind the code above,
1 Count all rows
2 Count all rows that are not null
3 If the results from 1 and 2 are the same then return the sum else return null.