By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table t (
id int generated always as identity,
a int,
b int,
c int
);
insert all
into t(a, b, c) values ( 1, 1, 1)
into t(a, b, c) values ( 2, null, 2)
into t(a, b, c) values (null, 3, 3)
into t(a, b, c) values ( 4, 4, 4)
select 1 from dual;
4 rows affected
select sum(value)
from t
unpivot (
value for x in (a, b, c)
);
SUM(VALUE) |
---|
25 |