SQL> SQL> /* DOC> 15 DOC> | DOC> 16 DOC> / | \ DOC> 18 19 20 DOC> / / \ DOC> 23 24 25 DOC> / | | DOC> 26 27 28 DOC> / | DOC> 29 30 DOC> DOC> DOC> Copy the whole tree in the same table to under a new node. DOC> The root node of the new tree will be 115. DOC>*/ SQL> SQL> select child_id,parent_id,PARENT_TREE_KEYS from tree_table; CHILD_ID PARENT_ID ---------- ---------- PARENT_TREE_KEYS -------------------------------------------------------------------------------- 15 /15 16 15 /15/16 18 16 /15/16/18 CHILD_ID PARENT_ID ---------- ---------- PARENT_TREE_KEYS -------------------------------------------------------------------------------- 19 16 /15/16/19 20 16 /15/16/20 23 18 /15/16/18/23 CHILD_ID PARENT_ID ---------- ---------- PARENT_TREE_KEYS -------------------------------------------------------------------------------- 26 23 /15/16/18/23/26 29 26 /15/16/18/23/26/29 24 19 /15/16/19/24 CHILD_ID PARENT_ID ---------- ---------- PARENT_TREE_KEYS -------------------------------------------------------------------------------- 27 24 /15/16/19/24/27 30 27 /15/16/19/24/27/30 25 19 /15/16/19/25 CHILD_ID PARENT_ID ---------- ---------- PARENT_TREE_KEYS -------------------------------------------------------------------------------- 28 25 /15/16/19/25/28 13 rows selected. SQL> SQL> insert into tree_table 2 select child_id+100, parent_id+100, 3 fact1,fact2, 4 sys_connect_by_path(child_id+100,'/') 5 from tree_table 6 start with child_id=15 7 connect by prior child_id=parent_id; 13 rows created. SQL> select child_id,parent_id,PARENT_TREE_KEYS from tree_table where child_id>100; CHILD_ID PARENT_ID ---------- ---------- PARENT_TREE_KEYS -------------------------------------------------------------------------------- 115 /115 116 115 /115/116 118 116 /115/116/118 CHILD_ID PARENT_ID ---------- ---------- PARENT_TREE_KEYS -------------------------------------------------------------------------------- 123 118 /115/116/118/123 126 123 /115/116/118/123/126 129 126 /115/116/118/123/126/129 CHILD_ID PARENT_ID ---------- ---------- PARENT_TREE_KEYS -------------------------------------------------------------------------------- 119 116 /115/116/119 124 119 /115/116/119/124 127 124 /115/116/119/124/127 CHILD_ID PARENT_ID ---------- ---------- PARENT_TREE_KEYS -------------------------------------------------------------------------------- 130 127 /115/116/119/124/127/130 125 119 /115/116/119/125 128 125 /115/116/119/125/128 CHILD_ID PARENT_ID ---------- ---------- PARENT_TREE_KEYS -------------------------------------------------------------------------------- 120 116 /115/116/120 13 rows selected. SQL> SQL> spool off