title: MYSQL Stored Procedures If statement Problem
body: <p>I'm working with Mysql 5.1.28-rc on freebsd. I've just decided to use stored procedures in MYSQL and created a test procedure as below:</p>
  
  <p><pre><code>DELIMITER $$ 
  DROP PROCEDURE IF EXISTS test $$
  CREATE PROCEDURE test( IN test VARCHAR(22) )
  BEGIN
   DECLARE count INT(11);
   SET count = (SELECT COUNT(*) FROM Test WHERE test_column = test );
   SELECT count;
   IF count = 0 THEN
    SET count = 1;
   ELSE
    SET count = 2;
   ENDIF;
  END $$
  DELIMITER;
  </pre> </code></p>
  
  <p>This procedure works well without IF statement in it , but with the if statement it gives, 
  <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 ';
  END'</code></p>
  
  <p>How can I solve this issue? Where is the problem?</p>