Oracle数据 行转列

记录一段行转列SQL代码:

select cs.standard_id,cs.area_code,cs.exu_dept,
regexp_substr(exu_dept, '[^,]+', 1, level) as dept_id  
     from ca_stand_exu_dept  cs
  connect by  
    id = prior id  
     and instr(exu_dept||',', ',', 1, level) > 0  
    and prior dbms_random.value is not null;

 

posted @ 2016-10-27 16:53  渴死的鱼丶  阅读(246)  评论(0编辑  收藏  举报