Description: Calls the instruct.grade_calc procedure to calculate a grade for a specific student and section. If a grade is returned with a valid return code, update the student's grade in the database, and call instruct.student_list to display the new information.
CREATE OR REPLACE PROCEDURE student_list_update (p_student_id IN student.student_id%TYPE, p_section_id IN section.section_id%TYPE) AS -------------------------------------------------------- -- FILENAME: student_list_update -- FILEDATE: 01.20.2003 -- CREATED BY: Susan Boardman -- DESCRIPTION: Calls instruct.grade_calc to determine a -- student grade for a particular section. -- URL : student_list_update -------------------------------------------------------- v_final_grade enrollment.final_grade%TYPE; v_exit_code char(1); BEGIN instruct.grade_calc(p_student_id, p_section_id, v_final_grade, v_exit_code); IF v_exit_code = 'S' then UPDATE enrollment SET final_grade=v_final_grade WHERE student_id=p_student_id AND section_id=p_section_id; COMMIT; htp.script('alert("Success! The final grade has been computed.");'); ELSIF v_exit_code = 'I' then htp.script('alert("Not all the required grades have been entered for this student in this section.");'); ELSIF v_exit_code = 'T' then htp.script('alert("Too many grades exist for this student. For example, there should only be 4 homeworks and there are 6.");'); ELSIF v_exit_code = 'N' then htp.script('alert("No grades have been entered for this student in this section.");'); ELSIF v_exit_code = 'E' then htp.script('alert("An error occurred when computing this grade. Please notify the application administrator and try again later.");'); END IF; instruct.student_list(p_section_id); EXCEPTION WHEN OTHERS THEN htp.p('An error occurred: '||SQLERRM||'. Please try again later.'); END;