|
4#:
SQL>
SQL> with t as (select level n from dual connect by level <=113),
2 s as (select n,to_char( to_date(n,'j'),'jsp') words_str,
3 regexp_count(to_char( to_date(n,'j'),'jsp'),'[a-z]',1) words_count
4 from t )
5 select t1.n n1,t2.n n2,t3.n n3,t4.n n4 --,s1.words_count cnt1,s2.words_count cnt2,s3.words_count cnt3,s4.words_count cnt4
6 from t t1,t t2,t t3,t t4,s s1,s s2,s s3,s s4
7 where t1.n + t2.n + t3.n + t4.n = 113
8 and t1.n < t2.n
9 and t2.n < t3.n
10 and t3.n < t4.n
11 and t1.n = s1.n
12 and t2.n = s2.n
13 and t3.n = s3.n
14 and t4.n = s4.n
15 and s1.words_count > s2.words_count
16 and s2.words_count > s3.words_count
17 and s3.words_count > s4.words_count
18 /
N1 N2 N3 N4
---------- ---------- ---------- ----------
23 24 26 40
|
|