• Oracle 向上递归、向下递归


    ---- 向上递归
    select
    distinct orgguid,dtb_orgguid,orgname from dtba_organization a start with orgguid = '2117bc0897e543168fd9702216165c77' connect by prior dtb_orgguid = orgguid
    orgguid 最小级别  



    ---- 向下递归
    select distinct orgguid,dtb_orgguid,orgname from dtba_organization a start with dtb_orgguid = '5ca832cb82ed487d9b946890692529fe'
    connect by prior orgguid
    = dtb_orgguid

    dtb_orgguid  最大级别





    --查询全部资源信息 
    select * from urm_class_info 
    --向上遍历树,找到路径直到根节点,指定的是parentid 
    select distinct classid,parentid,name 
    from urm_class_info 
    start with parentid = 'cmdb0000000000000017' 
    connect by prior parentid = classid 
    --向上遍历树,找到路径直到根节点,指定的是classid,和下面的主要区别就是parentid和classid的位置 
    select classid,parentid,name 
    from urm_class_info 
    start with classid = 'cmdb0000000000000401' 
    connect by prior parentid = classid 
    --向下遍历整棵树,可以指定classid,来遍历指定节点的树 
    select classid,parentid,name 
    from urm_class_info 
    start with classid = 'cmdb0000000000000017' 
    connect by prior classid = parentid 
    --向下遍历整棵树,可以指定parentid,来遍历指定parentid节点的树,不包含parentid 
    select classid,parentid,name 
    from urm_class_info 
    start with parentid = 'cmdb0000000000000017' 
    connect by prior classid = parentid 
  • 相关阅读:
    【转】@JoinColumn 详解
    Hibernate的getTransaction()和beginTransaction()
    什么是事务(transaction)?它有什么好处
    tomcat安装不成功.提示:failed to install tomcat6 service ,check your setting and permissions
    java面试题02
    JAVA面试题01
    浅析=======Struts2之==========valueStack
    Hibernate映射文件
    Hibernate核心配置文件
    激活Microsoft Word 2010
  • 原文地址:https://www.cnblogs.com/youmingkuang/p/5951976.html
Copyright © 2020-2023  润新知