create procedure transfer(coursecno char)
as
declare cour float;
begin
select * into cour from sc x where x.cno==coursecno;
if cour.score>=90&&cour.score<=100 then cour.score='A';
end if;
if cour.score>=80&&cour.score<90 then cour.score='B';
end if;
if cour.score>=70&&cour.score<80 then cour.score='C';
end if;
if cour.score>=60&&cour.score<70 then cour.score='D';
end if;
if cour.score>=0&&cour.score<60 then cour.score='E';
end if;
end
错在哪里了?
as
declare cour float;
begin
select * into cour from sc x where x.cno==coursecno;
if cour.score>=90&&cour.score<=100 then cour.score='A';
end if;
if cour.score>=80&&cour.score<90 then cour.score='B';
end if;
if cour.score>=70&&cour.score<80 then cour.score='C';
end if;
if cour.score>=60&&cour.score<70 then cour.score='D';
end if;
if cour.score>=0&&cour.score<60 then cour.score='E';
end if;
end
错在哪里了?
改成
declare @cour float;下面的也都改了
create procedure lisanmath(mathcno char)
as
declare n1 int;n2 int;n3 int;n4 int;n5 int;mathscore float;
begin
n1=0;n2=0;n3=0;n4=0;n5=0;
select * into mathscore from sc x where x.cno==mathcno;
if mathscore.score>=90&&mathscore.score<=100 then n1=n1+1;
end if;
if mathscore.score>=80&&mathscore.score<90 then n2=n2+1;
end if;
if mathscore.score>=70&&mathscore.score<80 then n3=n3+1;
end if;
if mathscore.score>=60&&mathscore.score<70 then n4=n4+1;
end if;
if mathscore.score>=0&&mathscore.score<60 then n5=n5+1;
end if;
end;
上面存储过程中,mathscore前面也没有加@,但我运行成功了。这是怎么回事?