Oracle Magazine, September/October 2018
Database Developer and DBA ETL ORACLE MAGAZINE SEPTEMBER OCTOBER 2018 87 Listing 1 A simple hierarchical query SQL select rpad level ename 2 from emp 3 start with mgr is null 4 connect by prior empno mgr ENAME KING BLAKE JAMES ALLEN WARD CLARK MILLER In this query I start with employees who have no manager MGR is NULL and then apply a CONNECT BY clause to traverse the hierarchy But what if no explicit hierarchical syntax was possible How would a hierarchy be traversed with standard SQL commands To achieve this I can break the query into its constituent parts First I need to extract the rows where the manager is not specified as shown in Listing 2 Listing 2 First level of the hierarchy SQL select empno ename mgr 2 from emp
You must have JavaScript enabled to view digital editions.