Build an Oracle query to get parent and child records
Such hierarchical queries can be written using CONNECT BY as:

SQL&gt; set null "empty"
SQL&gt; select id, dependency, prod, prod2 from forgerock
     connect by prior dependency = id start with prod2 = '102' order by level desc;

        ID DEPENDE PROD       PROD2
---------- ------- ---------- ----------------------
         1 empty   empty      empty
         2 1       Full       101
         4 2       Robust     102