Below is demo table:
select value
from
(
(
select
1 v1,
2 v2,
3 v3,
4 v4,
5 v5
from dual
)
unpivot
(
value
for value_type in
(v1,v2,v3,v4,v5)
)
)
output:
VALUE
----------
1
2
3
4
And We are looking for Total at the end something like below, to calculate total at the end result:
VALUE
----------
1
2
3
4
5
----------
sum=15
select value
from
(
(
select
1 v1,
2 v2,
3 v3,
4 v4,
5 v5
from dual
)
unpivot
(
value
for value_type in
(v1,v2,v3,v4,v5)
)
) group by rollup(value) -- rollup is not possible as its not a group by