原表如下 

select * from hs_acct.custattach a where a.client_id='888827395';

将列拆分成多行的语句

select 
*
from 
(
  ----将列拆分成多行的语句
  select distinct a.client_id
     ,REGEXP_SUBSTR(a.en_branch_no, '[^,]+', 1, L) AS en_branch_no 
  from hs_acct.custattach a, (SELECT LEVEL L FROM DUAL CONNECT BY LEVEL <= 10000) b
  WHERE b.L(+) <= LENGTH(a.en_branch_no) - LENGTH(REPLACE(a.en_branch_no, ',')) + 1
) tt
where trim(tt.en_branch_no) is not null
and tt.client_id='888827395';

 

 

 

 

 

 

 posted on 2021-11-26 17:01  dianli  阅读(2708)  评论(0编辑  收藏  举报