DYNAMIC RESULT SETS 1
LANGUAGE SQL
 BEGIN


	            BEGIN
					    DECLARE crs CURSOR WITH RETURN FOR
						     SELECT COUNT(DISTINCT os.PathID)
					         FROM StatementReference sr
					                 INNER JOIN OccurrencesStmt os ON sr.OccurID = os.OccurID
					                 INNER JOIN Paths pth ON os.PathID = pth.PathID
					         WHERE   sr.ResourceID IN (SELECT * FROM SESSION.numeric_param_temp) AND
							         (sr.ResourceType = 4 OR sr.ResourceType = 97)
							         AND sr.StatementType > 185
                                     AND sr.StatementType < 227 ;
						
				         OPEN crs;
				
                END;
END	
