posts - 310, comments - 6939, trackbacks - 0, articles - 3
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

Oracle Connect By用法

Posted on 2010-08-31 16:21 诗特林 阅读(2541) 评论(0)  编辑  收藏 所属分类: Oracle
Oracle Connect By用法

oracle中的select语句可以用START WITH...CONNECT BY PRIOR子句实现递归查询,connect by 是结构化查询中用到的,其基本语法是:

select ... from <TableName>
where <Conditional-1>
start with <Conditional-2>
connect by <Conditional-3>
;

<Conditional-1>:过滤条件,用于对返回的所有记录进行过滤。
<Conditional-2>:查询结果重起始根结点的限定条件。
<Conditional-3>:连接条件

select * from t_department where levels=2 start with id = 'D-06-04' connect by prior superior=id;

只有注册用户登录后才能发表评论。


网站导航: