|
这样更好
with t as(select level-1 l from dual connect by level<=10),
t1(a,p,lv) as(select l,power(2,l),1 from t
union all
select l,p+power(2,l),lv+1 from t1,t where a<l and lv<6),
a as(select p ,decode (bitand(p,64+512),64,p+512,512,p+64,p)pa from t1 where lv=6), --p actual ,pa expand
b as(select p,pa pb from a),
s as(select power(2,floor(level*level/10))s1,
power(2,mod(level*level,10))s2 from dual connect by level<=9),
j as(select pa,pb from a,b where pa<pb and not exists(select 1 from s where bitand(pa,s1)*bitand(pb,s2) =0
and bitand(pa,s2)*bitand(pb,s1)=0))
select count(*) from (
select pa,pb from j
); |
|