设为首页 加入收藏

TOP

oracle树形sql查询简析
2014-11-24 02:25:00 来源: 作者: 【 】 浏览:1
Tags:oracle 树形 sql 查询 简析
oracle树形sql查询简析
select typecode,lpad(' ',4*level-1)||typename
from ajtype
start with p_code is null connect by prior typecode=p_code;
结果:
1 +市容环卫
15 +灯光管理
151 +拒不安装
15101 +拒不安装夜景灯光设施
152 +违规安装
15201 +不按规定位置安装夜景灯光设施
15202 +不按规定形式安装夜景灯光设施
15203 +不按规定期限安装夜景灯光设施
15204 +不按规定光源色彩安装夜景灯光设施
153 +不按时亮灯 www.2cto.com
select sys_connect_by_path(typename,'>') typename
from ajtype
start with p_code is null connect by prior typecode=p_code;
1 >市容环卫
15 >市容环卫>灯光管理
151 >市容环卫>灯光管理>拒不安装
15101 >市容环卫>灯光管理>拒不安装>拒不安装夜景灯光设施
152 >市容环卫>灯光管理>违规安装
15201 >市容环卫>灯光管理>违规安装>不按规定位置安装夜景灯光设施
15202 >市容环卫>灯光管理>违规安装>不按规定形式安装夜景灯光设施
作者 使名扬
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇oracle取树形结构的数据,一条sql 下一篇Oracle手动建库中几个脚本的作用

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: