|
with t as (select level l from dual connect by level<=9),
t2 as(select l from(select level*2 l from dual connect by level<=998/2)
where substr(l,1,1)<>substr(l,2,1) and substr(l,1,1)<>substr(l,3,1) and substr(l,2,1)<>substr(l,3,1)),
t5 as(select l from(select level *7 l from dual connect by level<=999/7)
where (substr(l,2,1) ='5' or substr(l,2,1) ='0') and (substr(l,1,1)<>substr(l,2,1) and substr(l,1,1)<>substr(l,3,1) and substr(l,2,1)<>substr(l,3,1))),
t8 as(select l from(select level *17 l from dual connect by level<=999/17)
where substr(l,1,1)<>substr(l,2,1) and substr(l,1,1)<>substr(l,3,1) and substr(l,2,1)<>substr(l,3,1))
select t.l||t2.l||t5.l||t8.l, sum(t.l||t2.l||t5.l||t8.l) over()s
from t,t2,t5,t8
where mod(substr(t2.l,2,2)||substr(t5.l,1,1),3)=0
and mod(substr(t5.l,2,2)||substr(t8.l,1,1),11)=0
and mod(substr(t5.l,3,1)||substr(t8.l,1,2),13)=0
and translate('1234567890','#'||t.l||t2.l||t5.l||t8.l,'#')is null;
3.6秒 |
|