SELECT pv.pv_id, pkg.pkg_name, pv.pkg_version,
	   dpv.pv_id AS dpv_id, dpkg.pkg_name AS dpkg_name, dpv.pkg_version AS dpkg_version, 
	   DECODE ( dpv.is_deployable,
	   			NULL, 'Not Deployable!', NULL ) AS is_dep_deployable
  FROM PACKAGE_DEPENDENCIES dep,
  	   PACKAGES pkg,
  	   PACKAGE_VERSIONS pv,
	   PACKAGES dpkg,
	   PACKAGE_VERSIONS dpv
 WHERE dep.pv_id = pv.pv_id
   AND dep.dpv_id = dpv.pv_id
   AND pv.pkg_id = pkg.pkg_id
   AND dpv.pkg_id = dpkg.pkg_id
   AND dep.pv_id IN   
  	   (
		/* All deployment packages in release */
		SELECT rc.pv_id
		  FROM RELEASE_CONTENT rc
		 WHERE rc.RTAG_ID = :RTAG_ID
		   AND rc.BASE_VIEW_ID = :BASE_VIEW_ID
	    )		
ORDER BY UPPER(pkg.pkg_name)	