October 2002
Intermediate to advanced
688 pages
14h 14m
English
| 1) | Write a nested cursor where the parent cursor calls information about each section of a course. The child cursor counts the enrollment. The only output is one line for each course with the Course Name and Section Number and the total enrollment. |
| A1: |
Answer: Your answer should look similar to the following:
SET SERVEROUTPUT ON DECLARE CURSOR c_course IS SELECT course_no, description FROM course WHERE course_no < 120; CURSOR c_enrollment(p_course_no IN course.course_no%TYPE) IS SELECT s.section_no section_no, count(*) count FROM section s, enrollment e WHERE s.course_no = p_course_no AND s.section_id = e.section_id GROUP BY s.section_no; BEGIN FOR r_course IN c_course LOOP DBMS_OUTPUT.PUT_LINE (r_course.course_no||' ... |
Read now
Unlock full access