Did you have a look at the
documentation?
Specifically,
Oracle wrote:PRIOR is a unary operator and has the same precedence as the unary + and - arithmetic operators. It evaluates the immediately following expression for the parent row of the current row in a hierarchical query.
PRIOR is most commonly used when comparing column values with the equality operator. (The PRIOR keyword can be on either side of the operator.) PRIOR causes Oracle to use the value of the parent row in the column. Operators other than the equal sign (=) are theoretically possible in CONNECT BY clauses. However, the conditions created by these other operators can result in an infinite loop through the possible combinations. In this case Oracle detects the loop at run time and returns an error.
The only caveat here is that the "parent row" and "child row" don't refer to any referential integrity constraint (after all, you can build hierarchical queries over tables that do not have any referential integrity constraint at all), but instead refer to the hierarchy of rows build by the query itself. In more complicated queries, it might be hard to imagine how the hierarchy of rows looks like just by looking at the query - at least it is for me, so I usually shuffle the
PRIOR around a few times until the results look about right.
