你的位置:首页 > 数据库

[数据库]oracle 逗号分割,列转行


SQL代码

selectREGEXP_SUBSTR(a.rolecode ,'[^,]+',1,l)rolecodefrom (select 'a,aa,aaa' rolecode from dual) a,(SELECT LEVEL l FROM DUAL CONNECT BY LEVEL<=100) bWHERE l <=LENGTH(a.rolecode) - LENGTH(REPLACE(rolecode,','))+1