MySQL错误:1305。存储过程

时间:2012-06-28 12:56:00

标签: mysql stored-procedures

我正在

  

错误代码:1305。功能acdb_extended.player不存在

当我尝试调用存储过程时。关于错误的奇怪之处在于“播放器”不是存储过程的名称。

这是存储过程代码,可能有很多问题,但据我所知它是正确的:

CREATE PROCEDURE `acdb_extended`.`addAllianceMember` (IN accountNumber VARCHAR(255),
    IN userName VARCHAR(255), IN serverInitial CHAR(1), IN galaxy TINYINT(2),
    IN region TINYINT(2), IN system TINYINT(2), IN astro TINYINT(2), IN level TINYINT(2))
BEGIN
    IF player (account_number) = accountNumber
    THEN REPLACE INTO player (username)
        VALUES (userName);
    ELSE INSERT INTO player (account_number, username)
        VALUES (accountNumber, userName);
    END IF;

    IF coordinates (server_initial) = serverInitial AND
        coordinates (galaxy) = galaxy AND
        coordinates (region) = region AND
        coordinates (system) = system AND
        coordinates (astro) = astro
    THEN REPLACE INTO coordinates (player_ID)
        VALUES ((SELECT player_ID FROM player WHERE username = userName));
    ELSE INSERT INTO coordinates (player_ID, server_initial, galaxy, region, system, astro)
        VALUES ((SELECT player_ID FROM player WHERE username = userName), serverInitial,
            galaxy, region, system, astro);
    END IF;

    IF jumpgate (player_ID) = (SELECT player_ID FROM player WHERE username = userName) AND
            jumpgate (coordinates_ID) = (SELECT c.coordinates_ID FROM coordinates c, player p WHERE c.player_ID = p.player_ID
            AND p.username = userName)
    THEN REPLACE INTO jumpgate (level)
            VALUES (level);
    ELSE INSERT INTO jumpgate (player_ID, coordinates_ID, level, usable)
            VALUES ((SELECT player_ID FROM player WHERE username = userName),
                (SELECT c.coordinates_ID FROM coordinates c, player p WHERE c.player_ID = p.player_ID
                AND p.username = userName), level, TRUE);
    END IF;
END

这是我用来测试它的SQL语句:

CALL addAllianceMember(8494618, 'Carl', 'G', 29, 08, 10, 01, 04);

关于这出错的任何提示?

2 个答案:

答案 0 :(得分:1)

在这一行

IF player (account_number) = accountNumber

它就像一个函数一样调用播放器,它看起来像播放器不存在作为一个函数。

答案 1 :(得分:0)

这里你在BEGIN之后使用了Player作为函数。

BEGIN     如果玩家(account_number) = accountNumber