SELECT dpkg.pkg_id, dpkg.pkg_name, dpv.pkg_version, dpv.pv_id, dep.build_type,
       frc.pkg_version  AS lpkg_version, frc.pv_id AS lpv_id
  FROM package_dependencies dep,
       package_versions dpv,
       packages dpkg,
	   (
       /* Full Release Content */
	   SELECT rpv.pv_id, rpv.pkg_version, rpv.pkg_id, rpv.v_ext
	     FROM RELEASE_CONTENT rc,
		 	  PACKAGE_VERSIONS rpv
	    WHERE rc.rtag_id = :RTAG_ID
		  AND rc.pv_id = rpv.pv_id
       ) frc 
 WHERE dep.dpv_id = dpv.pv_id
   AND dpv.pkg_id = dpkg.pkg_id
   AND dep.pv_id = :PV_ID
   AND frc.pkg_id (+) = dpv.pkg_id
   AND NVL(frc.v_ext (+),'|LINK_A_NULL|') = NVL(dpv.v_ext,'|LINK_A_NULL|')
 ORDER BY UPPER(dpkg.pkg_name)
 