 DECLARE
v_s_id enrollments.stu_id%TYPE:=:stu_id;
CURSOR s_class_cur IS
SELECT enrollment_date, class_id, status
FROM enrollments
WHERE stu_id=v_s_id
AND enrollment_date BETWEEN ADD_MONTHS(sysdate,-72) AND SYSDATE;
BEGIN
DBMS_OUTPUT.PUT_LINE ('STUDENT '||v_s_id||' is enrolled in the following classes within the most recent 6 years:' );
FOR s_class_rec IN s_class_cur 
LOOP
DBMS_OUTPUT.PUT_LINE(s_class_rec.class_id||' with enrollment date '||s_class_rec.enrollment_date||' and with status '||s_class_rec.status);
END LOOP;
END;