Вы можете начать с cross join
и закончить case..when
инструкциями, как показано ниже:
with tab( cat1 , priceA , priceB , type1 ,
cat2 , costA , costB , type2 ) as
(
select 'UK' , 55, 70 , 'X' , 'CAN' , 25 , 15 , 'Z' from dual union all
select 'UK' , 30, 26 , 'Y' , 'IND' , 20 , 20 , 'Z' from dual union all
select 'NZ' , 38, 36 , 'Z' , 'GER' , 40 , 25 , 'Y' from dual union all
select 'USA', 47, 49 , 'Z' , 'AUS' , 60 , 15 , 'X' from dual
), tab2 as
(
select t1.cat1 , t1.priceA , t1.priceB , t1.type1,
t2.cat2 , t2.costA , t2.costB , t2.type2,
row_number() over ( partition by t1.cat1, t1.type1 order by t1.cat1, t1.type1 ) rn
from tab t1
cross join tab t2
), tab3 as
(
select t.*, mod(rn,2) as r2
from tab2 t
)
select distinct
( case when r2 = 1 then cat1 else cat2 end ) as cat1,
( case when r2 = 1 then priceA else costA end ) as priceA,
( case when r2 = 1 then priceB else costB end ) as priceB,
( case when r2 = 1 then type1 else type2 end ) as type1
from tab3;
CAT1 PRICEA PRICEB TYPE1
AUS 60 15 X
UK 55 70 X
NZ 38 36 Z
UK 30 26 Y
USA 47 49 Z
IND 20 20 Z
CAN 25 15 Z
GER 40 25 Y
Демо