zoukankan      html  css  js  c++  java
  • 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           +不按时亮灯

    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 >市容环卫>灯光管理>违规安装>不按规定形式安装夜景灯光设施

  • 相关阅读:
    The Balance POJ 2142 扩展欧几里得
    扩展欧几里得定理总结
    Crashing Robots POJ 2632 简单模拟
    POJ 1328 Radar Installation 贪心算法
    The Pilots Brothers' refrigerator DFS+枚举
    HDU RSA 扩展欧几里得
    HDU A/B 扩展欧几里得
    ACM 数学
    E
    BZOJ 3223: Tyvj 1729 文艺平衡树
  • 原文地址:https://www.cnblogs.com/tongzhenhua/p/1297253.html
Copyright © 2011-2022 走看看