本文主要是介绍orcale 的递归查询以及坑,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、无条件查询
SELECT USER_ID
FROM MP_USER_RELATION
START WITH MANAGER_ID = '0000000048f260cf0148f2fefc860004'
CONNECT BY USER_ID = MANAGER_ID
2、有条件查询
错误写法:
SELECT USER_ID
FROM MP_USER_RELATION
where RELATION_STATUS= 1
START WITH MANAGER_ID = '402879bb56011d710156013cae460003'
CONNECT BY USER_ID = MANAGER_ID
正确写法
SELECT USER_ID
FROM (SELECT* FROM MP_USER_RELATION WHERE RELATION_STATUS = 1 )
START WITH MANAGER_ID = '402879bb56011d710156013cae460003'
CONNECT BY USER_ID = MANAGER_ID
这篇关于orcale 的递归查询以及坑的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!