|
〇〇 发表于 2013-8-19 22:02 ![]()
因为题目已经出来超过4位数的,我原来以为8881会自动隔离,但如果后面凑上去的没有8就难讲了
对啊,所以我说你这个必须要在四位的部分加上过滤条件的。
trainer@ORCL> 2 t2 as(
3 select
4 a.l||b.l||c.l||d.l v4 --??
5 from t a,t b,t c,t d
6 where a.l+b.l+c.l+d.l in(4,9,16,25)
7 and a.l<>0
8 ),
9 r(vx,lv)as(
10 select cast(v4 as varchar(40)),1 from t2
11 union all
12 select vx||l,lv+1 from r,t
13 where
14 instr(vx,l,1,2)=0 --????2?,????????????
15 and substr(vx,-1,1)+substr(vx,-2,1)+substr(vx,-3,1)+l in(4,9,16,25)
16 and lv<=16)
17 select max(0+vx) from r where regexp_substr(vx, '([[:digit:]])(\1){2}') is not null;
MAX(0+VX)
--------------------
90004579457
|
|