|
递归cte什么时候实现呢?
用这个语句测试
with t as (select level-1 l from dual connect by level<=10),
r(v,lv)as(
select cast(l as varchar(40)),1 from t
union all
select v||l,lv+1 from r,t
where
instr(v,l,1,2)=0 --判断出现2次,新字符不能出现在已有串中
and (lv<3 or substr(v,-1,1)+substr(v,-2,1)+substr(v,-3,1)+l in(4,9,16,25))
and lv<=19)
select max(0+v) from r;
|
|