oracle 递归

1)此方法,父亲state = 9999,儿子state != 9999,儿子能查询出来

select * from T_ORGANIZATION ot
where ot.state!=9999 
start with  ot.id = 7  connect by prior ot.id = ot.ORG_PARENTID
order by ot.id asc

2)此方法,父亲state = 9999,儿子state != 9999,儿子不能查询出来

select * from 
(
	SELECT * FROM T_ORGANIZATION WHERE state != 9999
) ot 
START WITH ot.id = 7
CONNECT BY PRIOR ot.id = ot.ORG_PARENTID;

你可能感兴趣的:(oracle,oracle,递归)