例如:查找中国下面的所有子节点
select t.* from ( select t.*, sys_connect_by_path(n,'/') np , sys_connect_by_path(id,'/') ip,connect_by_isleaf from test t connect by prior t.id=t.parent --start with t.parent is not null ) t where t.ip like '%2%'
图1为数据库数据
图2为查询结果
1 楼 masuweng 2011-10-15
只是在oracle中能使用connect by prior