CONNECT BY Operators

The CONNECT BY operator can be used to define hierarchical conditions. For more details on the usage of this operator, refer to the CONNECT BY clause in the SELECT statement section.

Syntax

PRIOR operator::=

PRIOR Operator

CONNECT_BY_ROOT operator::=

CONNECT BY Root Operator

Example
SELECT last_name,
       PRIOR last_name PARENT_NAME,
       CONNECT_BY_ROOT last_name ROOT_NAME,
       SYS_CONNECT_BY_PATH(last_name, '/') "PATH"
    FROM employees
    CONNECT BY PRIOR employee_id = manager_id
    START WITH last_name = 'Clark';

LAST_NAME  PARENT_NAME  ROOT_NAME  PATH
---------  -----------  ---------  ------------------
Clark                   Clark      /Clark
Smith      Clark        Clark      /Clark/Smith
Brown      Smith        Clark      /Clark/Smith/Brown