/* Bom Added Product Location */ 
SELECT newbom.*
  FROM (
  
  		SELECT osc.PROD_ID,
			   nn.NODE_NAME ||'_'|| os.OS_NAME AS PK,
			   nt.NODE_ICON,
			   nn.NODE_ID,
			   nn.NODE_NAME,
			   os.OS_ID,
			   os.OS_NAME,
			   pkg.PKG_ID,
			   pkg.PKG_NAME,
			   pv.PKG_VERSION
		  FROM OS_CONTENTS osc,
		  	   OPERATING_SYSTEMS os,
			   NETWORK_NODES nn,
			   NODE_TYPES nt,
			   BOM_CONTENTS bc,
			   PACKAGE_VERSIONS pv,
			   PACKAGES pkg
		 WHERE osc.OS_ID = os.OS_ID
		   AND os.NODE_ID = nn.NODE_ID
		   AND bc.NODE_ID = nn.NODE_ID
		   AND osc.PROD_ID = pv.PV_ID
		   AND pv.PKG_ID = pkg.PKG_ID
		   AND nn.NODE_TYPE_ID = nt.NODE_TYPE_ID
		   AND bc.BOM_ID = :BOM_ID	
		   AND pv.PV_ID = :PROD_ID
		   
  	   ) newbom,
	   (
	   
	   	SELECT osc.PROD_ID,
			   nn.NODE_NAME ||'_'|| os.OS_NAME AS PK,
			   nn.NODE_ID,
			   nn.NODE_NAME,
			   os.OS_ID,
			   os.OS_NAME,
			   pkg.PKG_ID,
			   pkg.PKG_NAME,
			   pv.PKG_VERSION
		  FROM OS_CONTENTS osc,
		  	   OPERATING_SYSTEMS os,
			   NETWORK_NODES nn,
			   BOM_CONTENTS bc,
			   PACKAGE_VERSIONS pv,
			   PACKAGES pkg
		 WHERE osc.OS_ID = os.OS_ID
		   AND os.NODE_ID = nn.NODE_ID
		   AND bc.NODE_ID = nn.NODE_ID
		   AND osc.PROD_ID = pv.PV_ID
		   AND pv.PKG_ID = pkg.PKG_ID
		   AND bc.BOM_ID = :COMPARE_BOM_ID
		   		   
	   ) oldbom
		 WHERE newbom.PK = oldbom.PK (+) 
		   --AND newbom.PROD_ID = oldbom.PROD_ID (+)
		   AND newbom.PKG_ID  = oldbom.PKG_ID (+)

		   AND ( oldbom.PROD_ID != newbom.PROD_ID )
		   AND newbom.PROD_ID NOT IN 
		   (
		   	   SELECT osc.PROD_ID
			   FROM OS_CONTENTS osc,
			  	    OPERATING_SYSTEMS os,
					NETWORK_NODES nn,
					BOM_CONTENTS bc,
					PACKAGE_VERSIONS pv
			  WHERE osc.OS_ID = os.OS_ID
				AND os.NODE_ID = nn.NODE_ID
				AND bc.NODE_ID = nn.NODE_ID
				AND osc.PROD_ID = pv.PV_ID
				AND pv.IS_PATCH IS NULL
				AND bc.BOM_ID = :COMPARE_BOM_ID	
		  )	
 ORDER BY UPPER(newbom.NODE_NAME), UPPER(newbom.OS_NAME)  
 
 