Skip to content

STARTING

STARTING WITH
emp.employee_id = 100
CONNECT BY PRIOR
emp.employee_id = emp.manager_id;
100 | Steven | King | NULL
101 | Neena | Kochhar| 100
108 | Nancy | Greenberg | 101
109 | Daniel | Faviet | 108

The STARTING WITH clause in Oracle SQL is used for hierarchal querying. In this example, the query identifies a hierarchy of employees where employee relation starts ‘FROM’ employee_id 100 and moves ‘TO’ the corresponding manager_id. Result set is generated in a tree structure with ‘Starting’ being the root.