t2为公式表SELECT t3.col,nvl(tt.n,0)
FROM t3
left join (select t.f,sum(level) n from( select col, REGEXP_SUBSTR(formula, '[^-^+^*]+', 1, LEVEL) f
from T2
CONNECT BY LEVEL <= REGEXP_COUNT(formula, '[^-^+^*]+')
and rowid = prior rowid
and prior dbms_random.value is not null) t
start with t.col in (select col from t3)
CONNECT BY t.col = PRIOR f
group by t.f) tt on t3.col=tt.f
order by nvl(tt.n,0) desc
FROM t3
left join (select t.f,sum(level) n from( select col, REGEXP_SUBSTR(formula, '[^-^+^*]+', 1, LEVEL) f
from T2
CONNECT BY LEVEL <= REGEXP_COUNT(formula, '[^-^+^*]+')
and rowid = prior rowid
and prior dbms_random.value is not null) t
start with t.col in (select col from t3)
CONNECT BY t.col = PRIOR f
group by t.f) tt on t3.col=tt.f
order by nvl(tt.n,0) desc
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货