DYNAMIC RESULT SETS 1
LANGUAGE SQL
ss: BEGIN
            

	            BEGIN
					    DECLARE crs CURSOR WITH RETURN FOR
						SELECT DISTINCT   st.Description,
					                      pth.PathStr,
					                      os.StartRow,
					                      pt.ProgramType
					     FROM StatementReference sr
					            INNER JOIN OccurrencesStmt os ON sr.OccurID = os.OccurID
					            INNER JOIN Statements st ON sr.StatementType = st.StatementType
					            INNER JOIN Paths pth ON os.PathID = pth.PathID
					            INNER JOIN Programs prg ON os.ProgID = prg.ProgramID
					            INNER JOIN ProgramTypes pt ON prg.ProgramTypeID = pt.ProgramTypeID 
					     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
					     ORDER BY pth.PathStr,
					              os.StartRow,
					              st.Description;
					     
				         OPEN crs;
				
                END;
END ss	





