|
19#
SQL> with t as (select level n from dual connect by level<=33),
2 s(lvl,nlist,nsum) as (select 1,cast(n as varchar2(100)),n from t where mod(n,2)=1
3 union all
4 select s.lvl + 1,
5 s.nlist||','||t.n,
6 s.nsum + t.n
7 from s,t
8 where s.lvl < 6
9 and t.n > s.lvl
10 and s.nsum + t.n <= 33
11 and ( (mod(s.lvl+1,2) = 0 and mod(t.n,2)=0)
12 or (mod(s.lvl+1,2) = 1 and mod(t.n,2)=1)
13 )
14 )
15 select count(*)
16 from s
17 where lvl = 6
18 and nsum = 33
19 /
COUNT(*)
----------
462 |
|