创建完毕后,我们来测试一下,例如执行如下SQL:
select * from table(splitstr('Hello,Cnblogs!',','));其输出结果为一个两行的表,如下图:
将行转为列显示:
select a.column_value v1,b.column_value v2 from (select * from (select rownum rn,t.* from table(splitstr('Hello,Cnblogs!',',')) t)) a, (select * from (select rownum rn,t.* from table(splitstr('Hello,Cnblogs!',',')) t)) b where a.rn=1 and b.rn=2如图:
作者:李敬然(Gnie) 出处: {GnieTech} (http://www.cnblogs.com/gnielee/) 方法二、 select regexp_substr('Hello,Cnblogs!','[^,]+',1,level) from dual connect by level <= length('Hello,Cnblogs!')-length(REPLACE('Hello,Cnblogs!',',',''))+1;转载于:https://www.cnblogs.com/isoftware/p/4337273.html
相关资源:Oracle拆分字符串,字符串分割的函数