create procedure CAL_GPA @SNO varchar(12)
as declare @GPA float declare @score float declare @point int begin DECLARE test_Cursor CURSOR SCROLL FOR
SELECT
GRADE
from
SC
where
SC.SNO=@SNO open test_Cursor WHILE @@FETCH_STATUS=0 BEGIN FETCH NEXT
FROM
test_Cursor INTO @score if
(
@score<60
)
begin set @point=1 end else if
(
@score<75
)
begin set @point=2 end else if
(
@score<85
)
begin
set @point=3
end
else begin set @point=4 end set @GPA+=@point END
SQL
最新推荐文章于 2024-06-27 18:08:19 发布