일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- tomcat
- 가우스
- Eclipse
- 전자정부프레임워크
- PLSQL
- swingx
- jQuery
- GPS
- iBATIS
- JSON
- appspresso
- WebLogic
- Struts
- phonegap
- node.js
- sencha touch
- MySQL
- Android
- dock
- rowspan
- jsr 296
- PHP
- MFC
- Ajax
- ibsheet
- 선택적조인
- JDOM
- Google Map
- Spring
- oracle
Archives
- Today
- Total
Where The Streets Have No Name
How to display numbers in triangle format 본문
http://forums.oracle.com/forums/thread.jspa?threadID=608730
SQL> var N number
SQL> exec :N := 4
PL/SQL-procedure is geslaagd.
SQL> select lpad(' ',:N-i,' ') || ltrim(x) n
2 from dual
3 model
4 dimension by (1 i)
5 measures (cast('1' as varchar2(100)) x)
6 rules iterate(10000) until iteration_number = :N-1
7 ( x[for i from 2 to :N increment 1] = x[cv()] ||
8 case
9 when iteration_number+1 <= cv(i)
10 then ' ' || to_char(iteration_number+1)
11 end
12 )
13 order by i
14 /
N
----------------------------------------------------------------
1
1 2
1 2 3
1 2 3 4
4 rijen zijn geselecteerd.
SQL> exec :N := 10
PL/SQL-procedure is geslaagd.
SQL> select lpad(' ',:N-i,' ') || ltrim(x) n
2 from dual
3 model
4 dimension by (1 i)
5 measures (cast('1' as varchar2(100)) x)
6 rules iterate(10000) until iteration_number = :N-1
7 ( x[for i from 2 to :N increment 1] = x[cv()] ||
8 case
9 when iteration_number+1 <= cv(i)
10 then ' ' || to_char(iteration_number+1)
11 end
12 )
13 order by i
14 /
N
----------------------------------------------------------------
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
10 rijen zijn geselecteerd.
SQL> var N number
SQL> exec :N := 4
PL/SQL-procedure is geslaagd.
SQL> select lpad(' ',:N-level,' ') || ltrim(sys_connect_by_path(level,' ')) n
2 from dual
3 connect by level <= :N
4 /
N
-------------------------------------------------------------------------------------
1
1 2
1 2 3
1 2 3 4
4 rijen zijn geselecteerd.
SQL> exec :N := 10
PL/SQL-procedure is geslaagd.
SQL> select lpad(' ',:N-level,' ') || ltrim(sys_connect_by_path(level,' ')) n
2 from dual
3 connect by level <= :N
4 /
N
-------------------------------------------------------------------------------------
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
10 rijen zijn geselecteerd.