connect

oracle 使用案例:

select id,acceptor_id,assistant,assistant_id  
from task 
where id = '201801121631386536437623432287';

 数据:

遍历拆分:

select *
          from (SELECT id,
                 regexp_substr(acceptor, '[^,]+', 1, LEVEL) acceptor,
                 regexp_substr(acceptor_id, '[^,]+', 1, LEVEL) acceptor_id,
                 regexp_substr(assistant, '[^,]+', 1, LEVEL) assistant,
                 regexp_substr(assistant_id, '[^,]+', 1, LEVEL) assistantid
            FROM task tt
          CONNECT BY PRIOR id = id
                 AND PRIOR dbms_random.VALUE IS NOT NULL
                 AND LEVEL <=
                     length(acceptor) - length(REPLACE(acceptor, ',')) + 1) t
         where t.id = '201801121631386536437623432287';

数据:

 

 

 

 

posted on 2018-01-17 14:16  ckx0709  阅读(161)  评论(0编辑  收藏  举报

导航