To je přesně to, co pivot
je pro:
select
transaction,
"'BBK'",
"'SBK'",
"'OBK'",
"'IBK'"
from (
select
regexp_substr("col_a", '[^~]+', 1, 1) as transaction,
regexp_substr("col_a", '[^~]+', 1, 2) as code,
regexp_substr("col_a", '[^~]+', 1, 3) as country
from Table1 t)
pivot
(
MAX(country) for code in ('BBK','SBK','OBK','IBK')
);