我有一个类似的表:
with tab as(
select 'P710345,P345123 are not valid' m from dual
union all
select 'P901236,P234098,P675001 are not valid' m from dual)
select * from tab
我需要的是提取以开头的P
字符串并将这些字符串放入同一行的新列中。
最后结果:
P710345,P345123 are not valid | P710345 | P345123 | |
P901236,P234098,P675001 are not valid | P901236 | P234098 |P675001 |
我试图提取regexp_substr
:
with tab as(
select 'P710345,P345123 are not valid' m from dual
union all
select 'P901236,P234098,P675001 are not valid' m from dual )
select regexp_substr (m,'P\d\w+','2') b from tab
我目前被困在这里。