zoukankan      html  css  js  c++  java
  • orace递归查询

    --查询结果自己所有的前代节点(包括自己)。


    select * from orgTable o
    where nvl(o.canceled,0)<>1
    start with o.id='5661' connect by to_char(o.id)=prior to_char(o.supsubcomid)

    --查询结果自己所有的后代节点(包括自己)。


    select * from orgTable o where o.supsubcomid is not null
    AND nvl(o.canceled,0)<>1
    start with o.id='5661'
    connect by prior to_char(o.id)=to_char(o.supsubcomid)


    --查询结果自己所有的后代节点(不包括自己)。

    select * from orgTable o where o.id is not null
    AND nvl(o.canceled,0)<>1
    start with o.supsubcomid='5661'
    connect by prior to_char(o.id) =to_char(o.supsubcomid )



    --查询结果自己的第一代后节点和所有的前代节点(包括自己)。

    select o.* from orgTable o
    where nvl(o.canceled,0)<>1
    start with o.supsubcomid='5661'
    connect by to_char(o.id )= prior to_char(o.supsubcomid)

  • 相关阅读:
    PHP中关于字符串的连接
    好用的FireFox(FF)插件
    Scripted Operation
    Scripted device
    chgrp chown
    wait_for_devices
    mysql create user
    mysql
    create user mysql
    Inserting/Removing shutters and filters
  • 原文地址:https://www.cnblogs.com/furenjian/p/12404576.html
Copyright © 2011-2022 走看看