SELECT DISTINCT pv.pv_id AS prod_id, pkg.pkg_name, pv.pkg_version,
                pv.is_patch, pd.IS_REJECTED, pkg.pkg_id, pv.comments
           FROM bom_contents bc,
                operating_systems os,
                os_contents osc,
                PACKAGES pkg,
                package_versions pv,
				product_details pd
          WHERE bc.bom_id = :PRODUCTION_BOM
            AND os.node_id = bc.node_id
            AND osc.os_id = os.os_id
            AND osc.prod_id = pv.pv_id
            AND pkg.pkg_id = pv.pkg_id
			and pd.PROD_ID(+) = osc.PROD_ID
			and pkg.pkg_id = :PKG_ID
		  ORDER BY PROD_ID DESC