Get Hierarchial data in the table in Oracle

By Santhosh N

There is a construct called by name Connect By to get the hierarchial data (Parent child relationship data) inside the table in oracle

The CONNECT BY clause specifies the relationship between parent rows and child rows of the hierarchy. The connect_by_condition can be any condition, however, it must use the PRIOR operator to refer to the parent row.

Ex:

SELECT firstname, lastname, empid, managerid, LEVEL
  
FROM emp
  
CONNECT BY PRIOR empid = managerid;

Get Hierarchial data in the table in Oracle  (901 Views)