当前位置:   article > 正文

Oracle:connect_by_isleaf_connect by isleaf 筛选页节点

connect by isleaf 筛选页节点
select connect_by_isleaf isleaf,
            tb.switch_type_id,
            sys_connect_by_path(tb.package_id, '|') path,
            tb.record_type,
            tb.element_offset,
            tb.element_length,
            tb.element_encode_type,
            tb.element_align,
            tb.mask,
            tb.asn_type
            from (select b.switch_type_id,
                    b.package_id,
                    b.element_offset,
                    b.element_length,
                    b.element_encode_type,
                    nvl(b.element_align, 'L') element_align,
                    b.record_type,
                    nvl(b.mask, 'LH') mask,
                    b.asn_type,
                    b.switch_type_id || '|' || b.package_level || '|' || b.package_id level_child,
                    b.switch_type_id || '|' || (b.package_level - 1) || '|' || b.parent_package_id level_parent
                 from switch_asn_record b
                 ) tb
             start with tb.level_parent like '%|0|-1'
             connect by prior tb.level_child = tb.level_parent;

1、connect_by_isleaf是否是子节点;
2、sys_connect_by_path(tb.package_id, '|')   ==>  |xxx|xxx|xxx
3、start with tb.level_parent like '%|0|-1'  ==> 树的遍历以从什么开始
4、connect by prior tb.level_child = tb.level_parent;  ==>此层遍历之后,再将child作为parent,继续往下遍历
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/692369
推荐阅读
相关标签
  

闽ICP备14008679号