oracle 遍历 根节点
select rpad('*' ,6 * level , '*' )||first_name||' ' ||last_name ename , level
from employees
start with manager_id is null
connect by prior employee_id =manager_id
ENAME LEVEL
1 ******Steven King 1
2 ************Neena Kochhar 2
3 ******************Nancy Greenberg 3
4 ************************Daniel Faviet 4
5 ************************John Chen 4
6 ************************Ismael Sciarra 4
7 ************************Jose Manuel Urman 4
8 ************************Luis Popp 4
9 ******************Jennifer Whalen 3
10 ******************Susan Mavris 3
11 ******************Hermann Baer 3
12 ******************Shelley Higgins 3
13 ************************William Gietz 4
14 ************Lex De Haan 2
15 ******************Alexander Hunold 3
16 ************************Bruce Ernst 4
17 ************************David Austin 4
18 ************************Valli Pataballa 4
19 ************************Diana Lorentz 4
20 ************Den Raphaely 2
21 ******************Alexander Khoo 3
22 ******************Shelli Baida 3
23 ******************Sigal Tobias 3
24 ******************Guy Himuro 3
25 ******************Karen Colmenares 3
26 ************Matthew Weiss 2
27 ******************Julia Nayer 3
28 ******************Irene Mikkilineni 3
29 ******************James Landry 3
30 ******************Steven Markle 3
31 ******************Winston Taylor 3
32 ******************Jean Fleaur 3
33 ******************Martha Sullivan 3
34 ******************Girard Geoni 3
35 ************Adam Fripp 2
36 ******************Laura Bissot 3
37 ******************Mozhe Atkinson 3
38 ******************James Marlow 3
39 ******************TJ Olson 3
40 ******************Nandita Sarchand 3
41 ******************Alexis Bull 3
42 ******************Julia Dellinger 3
43 ******************Anthony Cabrio 3
44 ************Payam Kaufling 2
45 ******************Jason Mallin 3
46 ******************Michael Rogers 3
47 ******************Ki Gee 3
48 ******************Hazel Philtanker 3
49 ******************Kelly Chung 3
50 ******************Jennifer Dilly 3
51 ******************Timothy Gates 3
52 ******************Randall Perkins 3
53 ************Shanta Vollman 2
54 ******************Renske Ladwig 3
55 ******************Stephen Stiles 3
56 ******************John Seo 3
57 ******************Joshua Patel 3
58 ******************Sarah Bell 3
59 ******************Britney Everett 3
60 ******************Samuel McCain 3
61 ******************Vance Jones 3
62 ************Kevin Mourgos 2
63 ******************Trenna Rajs 3
64 ******************Curtis Davies 3
65 ******************Randall Matos 3
66 ******************Peter Vargas 3
67 ******************Alana Walsh 3
68 ******************Kevin Feeney 3
69 ******************Donald OConnell 3
70 ******************Douglas Grant 3
71 ************John Russell 2
72 ******************Peter Tucker 3
73 ******************David Bernstein 3
74 ******************Peter Hall 3
75 ******************Christopher Olsen 3
76 ******************Nanette Cambrault 3
77 ******************Oliver Tuvault 3
78 ************Karen Partners 2
79 ******************Janette King 3
80 ******************Patrick Sully 3
81 ******************Allan McEwen 3
82 ******************Lindsey Smith 3
83 ******************Louise Doran 3
84 ******************Sarath Sewall 3
85 ************Alberto Errazuriz 2
86 ******************Clara Vishney 3
87 ******************Danielle Greene 3
88 ******************Mattea Marvins 3
89 ******************David Lee 3
90 ******************Sundar Ande 3
91 ******************Amit Banda 3
92 ************Gerald Cambrault 2
93 ******************Lisa Ozer 3
94 ******************Harrison Bloom 3
95 ******************Tayler Fox 3
96 ******************William Smith 3
97 ******************Elizabeth Bates 3
98 ******************Sundita Kumar 3
99 ************Eleni Zlotkey 2
100 ******************Ellen Abel 3
101 ******************Alyssa Hutton 3
102 ******************Jonathon Taylor 3
103 ******************Jack Livingston 3
104 ******************Kimberely Grant 3
105 ******************Charles Johnson 3
106 ************Michael Hartstein 2
107 ******************Pat Fay 3