Oracle: Connect By Prior (Hierarchical Query)

First Example
select sys_connect_by_path(ename,' -> ') from scott.emp connect by prior empno=mgr start with mgr is null

















Second Example
select LPAD(' ',4*(LEVEL-1)) || ENAME ENAME from scott.emp connect by prior empno=mgr start with mgr is null



















Related Links
ORA-01436: CONNECT BY loop in user data
http://nimishgarg.blogspot.in/2011/02/ora-01436-connect-by-loop-in-user-data.html

Get All Month or Week Days Names
http://nimishgarg.blogspot.in/2010/01/oracle-sql-get-all-month-names-jan-to.html

Alpha Numeric Counter Or Sequence
http://nimishgarg.blogspot.in/2011/04/alpha-numeric-counter-or-sequence.html

Oracle: Fibonacci Series by SQL
http://nimishgarg.blogspot.in/2010/08/oracle-fibonacci-series-by-sql.html

Oracle SQL: Triangular Series (1 3 6 10 15 21)
http://nimishgarg.blogspot.in/2010/07/oracle-sql-triangular-series-1-3-6-10.html

1 comment:

  1. I would agree with you on some level - but also feel you are being
    too pedantic given the context.

    ReplyDelete