/* Finds all dependencies recursively for a package */
SELECT DISTINCT
      qry.dpv_id, dep_pkg.pkg_name, dep_pv.pkg_version, dep_pv.v_ext
FROM  (
          SELECT dep.dpv_id
          FROM package_dependencies dep
          START WITH dep.pv_id IN ( :PV_ID_A ) 
          CONNECT BY PRIOR dep.dpv_id = dep.pv_id
      ) qry,
      packages dep_pkg,
      package_versions dep_pv
WHERE qry.dpv_id = dep_pv.pv_id
  AND dep_pv.pkg_id = dep_pkg.pkg_id
  AND qry.dpv_id NOT IN
      (
          SELECT dep.dpv_id
          FROM package_dependencies dep
          START WITH dep.pv_id IN ( :PV_ID_B ) 
          CONNECT BY PRIOR dep.dpv_id = dep.pv_id
      )
ORDER BY UPPER(dep_pkg.pkg_name || ' ' || dep_pv.pkg_version)