[求助]关于存储过程的编写出现的问题
存储过程定义如下:CREATE PROCEDURE CAL_GPA
@SNO CHAR(7),
@GPA DEC(2,0) OUTPUT
AS
BEGIN
declare @GP4 DEC(2,0),@GP3 DEC(2,0),@GP2 DEC(2,0),@GP1 DEC(2,0);
SET @GP4=(SELECT SUM(4*CREDIT)/SUM(CREDIT) FROM Courses WHERE Courses.CNO IN (SELECT SC.CNO FROM SC WHERE SC.SNO=@SNO AND SC.GRADE>=85));
SET @GP3=(SELECT SUM(3*CREDIT)/SUM(CREDIT) FROM Courses WHERE Courses.CNO IN (SELECT SC.CNO FROM SC WHERE SC.SNO=@SNO AND SC.GRADE>=75 AND SC.GRADE<85));
SET @GP2=(SELECT SUM(2*CREDIT)/SUM(CREDIT) FROM Courses WHERE Courses.CNO IN (SELECT SC.CNO FROM SC WHERE SC.SNO=@SNO AND SC.GRADE>=60 AND SC.GRADE<75));
SET @GP1=(SELECT SUM(CREDIT)/SUM(CREDIT) FROM Courses WHERE Courses.CNO IN (SELECT SC.CNO FROM SC WHERE SC.SNO=@SNO AND SC.GRADE<60));
SET @GPA=(@GP4)+(@GP3)+(@GP2)+(@GP1);
IF @@rowcount=0
BEGIN
raiserror('error',16,1)
rollback transaction
END
END
GO
调用语句如下:
declare @GPA DEC(4,1)
execute CAL_GPA '0309203',@GPA OUTPUT
print @GPA
但是最后并没有输出GPA,请教错在哪