Hello all,
I'm attempting to create a procedure that updates a students grade and will insert the grade into a grades table. I'm pulling from a different table, the course table, to get the information I need. If the course_name ends with a certain letter, a grade is assigned which is then inserted into Grade in the grades table. Here's what I have:
create or replace procedure grade
is
assign_grade varchar2(1);
assign_class varchar2(30);
cursor c1 is
select course_name from course;
begin
for assign_class in c1
loop
if
(assign_class.course (Substr(course_name, -1, 1) between 'A' and 'F')) then assign_grade.grades :='A';
else if
(assign_class.course (Substr(course_name, -1, 1) between 'G' and 'K')) then assign_grade.grades :='B';
else if
(assign_class.course (Substr(course_name, -1, 1) between 'L' and 'P')) then assign_grade.grades :='C';
ELSE IF
(assign_class.course (Substr(course_name, -1, 1) between 'Q' and 'T')) then assign_grade.grades :='D';
ELSE IF
assign_class.course (Substr(course_name, -1, 1) between 'U' and 'Z')) then assign_grade.grades :='E';
end if;
END LOOP;
DBMS_OUTPUT.PUT_LINE('students grade is: ' || s_grade);
end;
My issue is I'm getting the error message posted in the title. There's an issue with my loop, but I can't pinpoint what. I'm not sure if I'm not inserting the data correctly in the look and that's the issue.
Any help is appreciated. Thanks,