创建表:
CREATE TABLE T_TREE (ID NUMBER, FATHER_ID NUMBER, NAME VARCHAR2(30));
插入数据:
INSERT INTO T_TREE VALUES (1, 0, 'A');
INSERT INTO T_TREE VALUES (2, 1, 'BC');
INSERT INTO T_TREE VALUES (3, 1, 'DE');
INSERT INTO T_TREE VALUES (4, 1, 'FG');
INSERT INTO T_TREE VALUES (5, 2, 'HIJ');
INSERT INTO T_TREE VALUES (6, 4, 'KLM');
INSERT INTO T_TREE VALUES (7, 6, 'NOPQ');
INSERT INTO T_TREE VALUES (0, 0, 'ROOT');
INSERT INTO T_TREE VALUES (4, 7, 'FG');
select * from t_tree t start with t.id=0 connect by nocycle prior t.id=t.father_id
http://www.blogjava.net/freeman1984/archive/2011/05/06/349668.html