用case和正则表达式可以处理,不知道列1的值为3时怎么处理,所以我没处理,你可以自己修改。
with t as
( select 1 col1, 'a,d' col2 from dual
union all
select 1, null from dual
union all
select 2, 'b,c' from dual
union all
select 2, 'b,c' from dual
union all
select 2, null from dual
union all
select 3, 'a,c' from dual
)
select col1, case when col1 = 1
then case when col2 is null then 'a'
when col2 is not null then regexp_substr(col2,'([a-b])')
else col2 end
when col1 = 2
then case when col2 is null then 'b'
when col2 is not null then regexp_substr(col2,'([c-d])')
else col2 end
else col2 end
from t;