日期:2014-05-17 浏览次数:21051 次
SQL> with tmp as
  2  (
  3    select '1|a,b,c' str from dual union all
  4    select '2|d,e,f' str from dual
  5  )
  6  select distinct id, regexp_substr(name,'[^,]+',1,level) name
  7   from (select substr(str,1,instr(str,'|')-1) id,
  8                substr(str,instr(str,'|')+1) name
  9          from tmp
 10        )
 11  connect by level<=length(name)-length(replace(name,',',''))+1
 12  order by id, name;
 
ID             NAME
-------------- --------------
1              a
1              b
1              c
2              d
2              e
2              f
 
6 rows selected