语法:
select ... from <TableName>
[where <Conditional-1>]
start with <Conditional-2>
connect by prior <Conditional-3>
举例:
select * from city start with root_id = 0 connect by prior id = root_id;
假设:这是一种树形数据结构,root_id来表示父节点
查询效果: 输出root_id = 0的节点和 其他所有子节点
举例2:
select * from t2 start with id = 1 connect by prior id = root_id;
查询效果:输出所有id=1节点和其子树
网友评论