AS SELECT DDCLElement.Name
FROM DDCLElement 
WHERE 
 DDCLElement.DdsTypeId=11
 AND DDCLElement.Id IN (SELECT * FROM #numeric_param_temp) 
 AND DDCLElement.id not in (
 	select distinct DDCLElementChild.id
 	FROM DDCLElement 
	INNER JOIN DDCLValue ON DDCLElement.Id=DDCLValue.ElementId 
	INNER JOIN DDCLProperty ON DDCLValue.PropertyId=DDCLProperty.Id 
	INNER JOIN DDCLElement AS DDCLElementChild ON DDCLValue.ReferenceName=DDCLElementChild.Name 
		AND DDCLValue.ReferenceDdsTypeId=DDCLElementChild.DdsTypeId 
	WHERE DDCLElement.DdsTypeId IN (11,16,26,27,28)
	AND DDCLElementChild.Id IN (SELECT * FROM #numeric_param_temp) 
	AND DDCLValue.ReferenceDdsTypeId=11
	AND DDCLValue.ValueTypeId in (2,4) 
	AND DDCLElement.islocal='false'
	AND DDCLProperty.Name='PROCESSING-STRUCTURE' 	
 )
  AND DDCLElement.id not in (select DDCLElement.Id
	from DDCLElement inner join DDCLValue on DDCLElement.Id = DDCLValue.ElementId
	WHERE DDCLValue.Name = 'COMPONENT-ID' AND DdsTypeId = 11   
	and DDCLValue.Value in (Select  Programs_1.ProgramName FROM Programs INNER JOIN OccurrencesStmt ON Programs.ProgramID = OccurrencesStmt.ProgID 
							INNER JOIN StatementReference ON OccurrencesStmt.OccurID = StatementReference.OccurID 
							INNER JOIN Occurrences on Occurrences.OccurID=Programs.OccurID INNER JOIN Paths on Occurrences.PathID=Paths.PathID 
							INNER JOIN Programs AS Programs_1 ON StatementReference.ResourceID = Programs_1.ProgramID 
							WHERE (StatementReference.ResourceType = 5)
							AND Programs.OccurID <> 0)
 )
ORDER BY DDCLElement.Name 