Oto sposób na zrobienie tego za pomocą podzapytań i agregacji:
select name,
sum(case when fy = 2014 then x end) as "2014",
sum(case when fy = 2015 then x end) as "2015",
sum(case when fy = 2016 then x end) as "2016"
from (select fy,
(case when n.n = 1 then 'x1'
when n.n = 2 then 'x2'
when n.n = 3 then 'x3'
when n.n = 4 then 'x4'
end) as name,
(case when n.n = 1 then x1
when n.n = 2 then x2
when n.n = 3 then x3
when n.n = 4 then x4
end) as x
from temp_table cross join
(select 1 as n from dual union all
select 2 from dual union all
select 3 from dual union all
select 4 from dual
) n
) t
group by name;
Możesz także użyć pivot
, ale jest to bardzo nowy dodatek do Oracle SQL, więc jestem skłonny użyć tej metody.