假如表数据如下:
t_id p_id node
1
2 1 b
3 1 c
4 2 d
5 2 e
树的形状为
a
| \
b c
| \
d e
递归代码为:select t_id, p_id, node from tree
connect by prior t_id = p_id
start with t_id = 1