title: MySQL: IF in stored procedure
body: <p>I am just getting my feet wet with stored procedures. According to the tutorials that I have seen, this should be valid (MySQL 5.5):</p>
  
  <pre><code>CREATE PROCEDURE someFunction ( a VARCHAR(256),  b VARCHAR(256) )
      BEGIN
          DECLARE haveAllVariables INT;
          SET haveAllVariables = 1;
  
      IF     a = "" THEN SET haveAllVariables = 0
      ELSEIF b = "" THEN SET haveAllVariables = 0
      END IF;
  </code></pre>
  
  <p>However, it is throwing this error:</p>
  
  <pre><code>ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
  corresponds to your MySQL server version for the right syntax to use near 'ELSEI
  F b = "" THEN SET haveAllVariables = 0
  </code></pre>
  
  <p>Where is the error in my syntax?</p>
  
  <p>Thanks.</p>