oracle 临时变量赋值问题
小弟弄了一个procedure,但由于临时变量的赋值问题一直编译错误。求指导!
代码:
create or replace procedure CAL_GPA (SNO_ varchar,GPA out number)
as
cal_gra int;
cal_cre int;
cursor cur_ is
select * from courses natural join SC
where SNO=SNO_ ;
begin
for result in cur_ loop
begin
if(result.GRADE>=85)
then (cal_gra:=(4*result.CREDIT+cal_gra);
cal_cre:=result.CREDIT+cal_cre);
end if;
if(result.GRADE<85 and result.GRADE>=75)
then (cal_gra:=3*result.CREDIT+cal_gra;
cal_cre:=result.CREDIT+cal_cre);
end if;
if(result.GRADE<75 and result.GRADE>=60)
then (cal_gra:=2*result.CREDIT+cal_gra;
cal_cre:=result.CREDIT+cal_cre);
end if;
if(result.GRADE<60)
then (cal_gra:=result.CREDIT+cal_gra;
cal_cre:=result.CREDIT+cal_cre);
end if;
select
end;
end loop;
GPA:=cal_gra/cal_cre;
end;
错误:
[最优解释]
if(result.GRADE>=85)
then (cal_gra:=(4*result.CREDIT+cal_gra);
elsecal_cre:=result.CREDIT+cal_cre);
end if;
....
if(result.GRADE<60)
then (cal_gra:=result.CREDIT+cal_gra;
elsecal_cre:=result.CREDIT+cal_cre);
end if;
select
end;
[其他解释]
已经解决了。感谢!