17,377
社区成员
发帖
与我相关
我的任务
分享
select rn
REGEXP_SUBSTR(a, '[^,]+', 1, LEVEL) STR
from (select a,rownum rn from t)
CONNECT BY LEVEL <= REGEXP_COUNT( a, ',') + 1
and rn= prior rn
and prior dbms_random.value is not null;
注意:regexp_count在11g以后才能使用,如果是11g以前需换成
length(a)-length(replace(a,',',''))[/quote]
正解,但是发现你select rn后少了个逗号,嘻嘻select rn
REGEXP_SUBSTR(a, '[^,]+', 1, LEVEL) STR
from (select a,rownum rn from t)
CONNECT BY LEVEL <= REGEXP_COUNT( a, ',') + 1
and rn= prior rn
and prior dbms_random.value is not null;
注意:regexp_count在11g以后才能使用,如果是11g以前需换成
length(a)-length(replace(a,',',''))[/quote]
这个如果不是单个的数字而是一长串用逗号分隔的电话号码也可以吗?select rn
REGEXP_SUBSTR(a, '[^,]+', 1, LEVEL) STR
from (select a,rownum rn from t)
CONNECT BY LEVEL <= REGEXP_COUNT( a, ',') + 1
and rn= prior rn
and prior dbms_random.value is not null;
注意:regexp_count在11g以后才能使用,如果是11g以前需换成
length(a)-length(replace(a,',',''))