create or replace procedure show_missing_grades (p_start_date IN date DEFAULT ADD_MONTHS(SYSDATE,-12),p_end_date IN date DEFAULT SYSDATE)
as
cursor missing_grades_cur
is
select class_id,stu_id,status
from enrollments
where enrollment_date between p_start_date and p_end_date and
final_numeric_grade is null and final_letter_grade is null
order by enrollment_date;
begin
for v_rec in missing_grades_cur
loop
dbms_output.put_line('class_id '||v_rec.class_id||' student_id '||v_rec.stu_id||' status '||v_rec.status);
end loop;
end;


create or replace PROCEDURE show_class_offerings(p_start_date date,p_end_date date)
AS

   CURSOR c1 IS SELECT course_id,class_id,start_date,instr_id FROM classes WHERE start_date BETWEEN p_start_date AND p_end_date;
   CURSOR c2(p_course_id NUMBER,p_instr_id NUMBER) IS SELECT i.first_name,i.last_name,c.title,c.section_code 
       FROM courses c, instructors i 
       WHERE c.course_id = p_course_id AND i.instructor_id=p_instr_id; 
   
BEGIN 
   DBMS_OUTPUT.PUT_LINE('Date range: Between '||p_start_date||' and '||p_end_date||'.'); 
   DBMS_OUTPUT.PUT_LINE('Classes Information.'); 
   FOR v_c1 IN c1 LOOP
     FOR v_c2 in c2(v_c1.course_id,v_c1.instr_id) LOOP
        DBMS_OUTPUT.PUT_LINE('Class ID '||v_c1.class_id||' Start Date'||v_c1.start_date||' Instructor '||v_c2.first_name||' '||v_c2.last_name||' Course Title '||v_c2.title ||' Section Code '||v_c2.section_code ); 
     END LOOP; 
   END LOOP; 
end show_class_offerings;
