/* Bom Details */
SELECT bo.*,
       bn.BOM_NAME,
	   bec.BASE_ENV_COUNT
  FROM BOMS bo,
  	   BOM_NAMES bn,
	   (
	    SELECT COUNT(*) AS BASE_ENV_COUNT,
			   be.BOM_ID
		  FROM BASE_ENV be
		 WHERE be.BOM_ID = :BOM_ID
		 GROUP BY be.BOM_ID
	   ) bec
 WHERE bo.BOM_NAME_ID = bn.BOM_NAME_ID
   AND bo.BOM_ID = :BOM_ID
   And bec.BOM_ID (+) = bo.BOM_ID
   