Hey guys, I'm working on a stored procedure, but I'm stuck on how to output the cursor below. I want it to take any course I give it, and spit back out the count, the course number, and the course description. Here's what I have so far:
EXEC STUDENT_COUNT_COURSE('CS 101');
CALLS
CREATE OR REPLACE PROCEDURE STUDENT_COUNT_COURSE (p_CrsNum IN COURSE.COURSENUM%TYPE)
IS
cursor cursor1 IS
SELECT CourseDesc.courseNum, CourseDesc.courseDesc, COUNT(DISTINCT Student.studentID) as "Count",
FROM Course INNER JOIN
CourseDesc ON Course.courseNum = CourseDesc.courseNum INNER JOIN
Grades ON Course.courseID = Grades.courseID INNER JOIN
Student ON Grades.studentID = Student.studentID
WHERE (CourseDesc.courseNum = p_CrsNum)
GROUP BY CourseDesc.courseNum, CourseDesc.courseDesc;
begin
for c in cursor1
loop
dbms_output.putline('There are COUNT students in' || c.courseNum ||', '|| c.dourseDesc);
//still working on count...
end loop;
end;