Error is in the lines:
if(stud_mark > 50) then
...
else if(stud_mark = 50) then
Change them to:
if(s_stud_mark > 50) then
...
else if(s_stud_mark = 50) then
Update 1:
but another error is showing "Error Code: 1366. Incorrect integer value: 'G' for column 's_stud_mark' at row 11
It is because, you defined stud_mark
as int
in your table but you are assigning a char
into it in the routine. You should actually have defined a variable s_stud_status
in the routine and assigned value to it like set s_stud_status='G';
.
Similarly for other grade values in the routine.
And change the code as below, wherever required.
if(s_stud_mark > 50) then
set s_stud_status='G';
insert into grade(`stud_id`,`stud_status`) values(s_stud_id,s_stud_status);
else ...
set s_stud_status='E';
...