/* Base Env Contents */
SELECT bec.*,
	   pkg.pkg_name,
	   pv.pkg_version,
	   pd.IS_REJECTED,
	   pv.IS_PATCH,
	   pv.IS_OBSOLETE
  FROM PACKAGES pkg,
  	   PACKAGE_VERSIONS pv,
	   PRODUCT_DETAILS pd, 
	   (
		SELECT bas.*
		  FROM base_env_contents bas
		 WHERE bas.base_env_id = :BASE_ENV_ID
	   ) bec
 WHERE pv.pkg_id = pkg.pkg_id
   AND bec.prod_id = pv.pv_id	
   AND pd.PROD_ID (+)= pv.PV_ID
ORDER BY bec.seq_num
