title: MySQL IF...THEN followed by Query Statement
body: <p>Is something like this valid in MySQL: </p>
  
  <pre><code>DELIMITER //
  CREATE FUNCTION LOGIN_VALIDATE(IN uName VARCHAR(32),IN uPass VARCHAR(32))
  RETURNS BOOLEAN
  BEGIN
      DECLARE row_count BOOLEAN DEFAULT 0;
      DECLARE stored_pass VARCHAR(32) DEFAULT NULL;
      DECLARE valid_return BOOLEAN DEFAULT 0;
      SELECT count(*) INTO row_count FROM Login WHERE userId='uName';
      IF row_count = 1 THEN 
          SELECT pWord INTO stored_pass FROM Login WHERE userId='uName';
      END IF;
      IF stored_pass = 'uPass' THEN 
          SET valid_return = 1;
      END IF;
      RETURN valid_return;
  END //
  DELIMITER ;
  </code></pre>