我有以下 MySQL 查询:
DELIMITER //
CREATE PROCEDURE InsertResult (IN winnerID INT, IN loserID INT)
BEGIN
INSERT INTO KomperResult (WinnerID, LoserID) VALUES (@winnerID, @loserID);
DECLARE winnerScore, loserScore INT;
SELECT Score INTO @winnerScore FROM KomperPerson WHERE ID = @winnerID;
SELECT Score INTO @loserScore FROM KomperPerson WHERE ID = @loserID;
IF (@loserScore >= @winnerScore) THEN UPDATE KomperPerson SET Score = @loserScore + 1 WHERE ID = @winnerID; END IF;
END//
我收到一个错误:
DECLARE winnerScore, loserScore INT;
我究竟做错了什么?