title: MySQL Error: 1305. Stored Procedures
body: <p>I'm getting </p>
  
  <blockquote>
    <p>Error Code: 1305. FUNCTION acdb_extended.player does not exist</p>
  </blockquote>
  
  <p>When I attempt to call a stored procedure. The odd thing about the error is that "player" isn't the name of the stored procedure.</p>
  
  <p>Here's the stored procedure code, there is probably a number of things wrong with it but it's correct as far as I can tell:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>And here is the SQL statement I'm using to test it:</p>
  
  <pre><code>CALL addAllianceMember(8494618, 'Carl', 'G', 29, 08, 10, 01, 04);
  </code></pre>
  
  <p>Any hints on where this is going wrong?</p>