我有以下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;
我做错了什么?
答案 0 :(得分:5)