ORACLE 按逗号拆分字符串为多行
时间:2021-07-01 10:21:17
帮助过:5人阅读
t
as
(select ‘1,2,3,10,11,12‘ a
from dual)
select substr(a,
decode(level - 1,
0,
0, instr(a,
‘,‘,
1,
level - 1))
+ 1,
(decode(level,
regexp_count(a, ‘,‘)
+ 1,
length(a) + 1,
instr(a, ‘,‘,
1,
level)))
-
(decode(level - 1,
0,
0, instr(a,
‘,‘,
1,
level - 1))
+ 1))
from t
connect by level <= regexp_count(a,
‘,‘)
+ 1;
ORACLE 按逗号拆分字符串为多行
标签:color length rac nec sel exp ora log count