第一种情况 文屏路39-1号802室
==
拿这个来说 最后展示为
路 号 座 室
文屏路 39-1 (没有标明就为空) 802 这个比较好解决。可以搞定下面的
难题:
1:水仙大街42号闽南商业城综合楼B幢302室
这个最终的展现是
路 号 座 室
水仙大街 2号 B 302
2: 厦港新村23-302-0002
这个最终的展现是
路 号 座 室
厦港新村 23 空 302 像这个形式 座都是为空的
求解答!!!
------最佳解决方案--------------------
水仙大街42号
明明是42号,你怎么搞了个2号,难道我理解有误?
------其他解决方案--------------------
with t(col) as(
select '文屏路39-1号802室' from dual
union all select '水仙大街42号闽南商业城综合楼B幢302室' from dual
union all select '厦港新村23-302-0002' from dual
)
select
regexp_substr(col,'[^0-9]*') 路,
regexp_replace(
decode(regexp_substr(col,'[0-9-]+号'),null,regexp_substr(col,'[0-9]+'),
regexp_substr(col,'[0-9-]+号')),'号','') 号,
regexp_replace(regexp_substr(col,'[0-9a-zA-Z]+(座