I have a oracle table which looks like this:
Schema:
(number) node_id
(number) parent_id
(number) parent_seq
Each entry in the table represents a single parent/child relationship. A parent can be the parent for multiple children and a child can have multiple parents (but we can assume that no cycles exist because that is validated before committing). If a child has multiple parents then it will have more than one row corresponding to its node_id in the table, and the parent_seq will increment for each parent.
Now, I dont need to rebuild the entire tree, I just need to know the DEPTH of each node. DEPTH as following the common definition of (What is the difference between tree depth and height?)
The depth of a node is the number of edges from the node to the tree's root node.
Is there a way to do this gracefully in Oracle using the CONNECT_BY syntax?