• 周二. 8月 16th, 2022

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

ORACLE——初用递归

admin

11月 28, 2021

SELECT ROWNUM,bmbaent,bmbasite,
      connect_by_root(bmaa001) root,
      bmba002,bmaa001,bmba003,
      LEVEL level1,
      sys_connect_by_path(LEVEL,'') level2
FROM bmaa_t 
INNER JOIN bmba_t ON bmbaent=bmaaent AND bmbasite=bmaasite AND bmba001=bmaa001 AND bmba002=bmaa002
START WITH bmaaent=90 AND bmaasite='D' AND bmaa001='3102010165' AND bmaa002=9 AND bmaastus='Y' 
CONNECT BY bmaa001 = PRIOR bmba003 AND bmba006 IS NULL AND bmbaent=90 AND bmbasite='D' AND bmba002=9 
ORDER BY ROWNUM

学习参考资料:

https://www.cnblogs.com/benbenduo/p/4588612.html 

https://www.cnblogs.com/supermandy/p/7873233.html 

发表回复

您的电子邮箱地址不会被公开。