title: MySQL PREPARE statement in stored procedures
body: <p>I have this sql file:</p>
  
  <pre><code>USE mydb;
  
  DROP PROCEDURE IF EXISTS execSql;
  DELIMITER //
  CREATE PROCEDURE execSql (
                       IN sqlq VARCHAR(5000)
                        ) COMMENT 'Executes the statement'
  BEGIN
    PREPARE stmt FROM sqlq;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt;
  END //
  DELIMITER ;          
  </code></pre>
  
  <p>When I try to run it with</p>
  
  <p># cat file.sql | mysql -p</p>
  
  <p>I get</p>
  
  <pre><code>ERROR 1064 (42000) at line 6: 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 'sqlq;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt;
    END' at line 5
  </code></pre>
  
  <p>What am I doing wrong?</p>