巧用:regexp_substr 对知道数据进行分割

---Demo

select *
from org_organization_definitions org
where org.ORGANIZATION_CODE in
(select regexp_substr(replace(字符参数, ',', ','),
'[^,]+',
1,
rownum) buyers
from dual
connect by rownum <=
length(replace(字符参数, ',', ',')) -
length(replace(replace(字符参数, ',', ','),
',',
'')) + 1)

 

------示例

select regexp_substr(replace('101,102,702,703', ',', ','),
'[^,]+',
1,
rownum) buyers
from dual
connect by rownum <=
length(replace('101,102,702,703', ',', ',')) -
length(replace(replace('101,102,702,703', ',', ','), ',', '')) + 1

---结果

 

posted @ 2024-05-31 08:32  Iven_lin  阅读(38)  评论(0)    收藏  举报