[color=blue]请关注新浪微博 账号:大数据进行时([url]http://weibo.com/u/3272022684[/url])[/color]
select * from
(select t.postid,
t.name,
t.parentid
from gaus_postinfo t
start with t.parentid ='GAUS_POSTINFO_8e29081b-8cba-41be-a1da-fdba0ba94a86'
connect by prior t.postid = t.parentid
)treeTable
--查看树
select * from
(select a.menu_name,
a.parent_id,
level "层次",
sys_connect_by_path(menu_name, '.') "合并层次",
prior a.menu_name "父节点",
connect_by_root a.menu_id "根节点",
decode(connect_by_isleaf, 1, a.menu_name, null) "子节点",
decode(connect_by_isleaf, 1, '是', '否') isleaf
from ipbp_webmenu a
start with a.parent_id =1003 --从parent为空开始扫描
connect by prior a.menu_id = a.parent_id --以child为父列连接parent
order siblings by menu_id desc --对层次排序
)treeTable
where treeTable.isleaf='是'