title: MYSQL Error while calling stored procedure
body: <p>I am trying to create a stored procedure, but while calling I am getting below error.</p>
  
  <p>Stored procedure is as follows</p>
  
  <pre><code>CREATE DEFINER=`root`@`%` PROCEDURE `CreateTableProjectIssues`(IN projName     VARCHAR(200), IN tablName VARCHAR(200))
  BEGIN
  SET @comnd = CONCAT('create table ',tablName,' as ( select r1.key, s1.comments, p1.fname, s1.line, s1.status 
   FROM test.issues s1, test.proj p1, test.rules r1 
   WHERE s1.root_component_id=(select id from test.proj p2 
                                     where p2.name=''',projName,''') 
         and s1.component_id=p1.id 
         and s1.rule_id=r1.id');
   PREPARE stmt FROM @comnd;
   EXECUTE stmt;
  END
  </code></pre>
  
  <p>And getting below error</p>
  
  <blockquote>
    <p>Error Code: 1064. 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 '' at line 5</p>
  </blockquote>
  
  <p>Note: I know SQL query is badly formed, not used join.</p>
  
  <p>Any idea why this error?</p>