title: How to get MYSQL dynamic query using stored procedure?
body: <p>I am trying to run the dynamic query using a stored procedure in which I am sending the where condition case for example.</p>
  
  <p>My sample stored procedure is shown here:</p>
  
  <pre><code>CREATE PROCEDURE `Storedproc`(IN getwhereconditon varchar(1000))
      BEGIN
      set @param=getwhereconditon ;
      SET @S=concat('Select * from table where (1)',@param);
      PREPARE stmt1 FROM @s;
      EXECUTE stmt1;
      END
  </code></pre>
  
  <p>Here my stored procedure's name is <code>Storedproc</code> in which I am passing the where condition details and when I call my stored procedure I am getting this 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 '0tablecol=1' at line</p>
  </blockquote>