title: CONCAT is not working in mysql stored procedure
body: <pre><code>DROP PROCEDURE IF EXISTS Cursor_Test;# MySQL returned an empty result set (i.e. zero rows).
  
  DELIMITER $$
  
  CREATE PROCEDURE Cursor_Test()
  BEGIN
  
    DECLARE Project_Number_val VARCHAR( 255 );
    DECLARE Project_List_val VARCHAR(255);
  
  
  
    DECLARE no_more_rows BOOLEAN;
    DECLARE loop_cntr INT DEFAULT 0;
    DECLARE num_rows INT DEFAULT 0;
  
  
    DECLARE projects_cur CURSOR FOR
      SELECT Project_Id
      FROM Project_Details;
  
  
    DECLARE CONTINUE HANDLER FOR NOT FOUND
      SET no_more_rows = TRUE;
  
  
    OPEN projects_cur;
    select FOUND_ROWS() into num_rows;
  
    the_loop: LOOP
  
      FETCH  projects_cur
      INTO   Project_Number_val;
  
  
      IF no_more_rows THEN
          CLOSE projects_cur;
          LEAVE the_loop;
      END IF;
  
  SET Project_List_val=CONCAT(`Project_Number_val`,'_List')
  </code></pre>
  
  <p>-</p>
  
  <pre><code>&gt; ---&gt; **Please check am I doing CONCAT correct here?**
  
  
  Insert Into test (Panel_Id) select Panel_Id from Project_List_val where Project_Number_val='9';  
  
  &gt; ---&gt;**Is this taking 9_List as table name?**
  
  
      SET loop_cntr = loop_cntr + 1;
    END LOOP the_loop;
  
  
    select num_rows, loop_cntr;
  
  
  END $$# MySQL returned an empty result set (i.e. zero rows).
  
  
  DELIMITER 
  </code></pre>
  
  <p>Any suggestions?
  Hi All,</p>
  
  <p>I have a variable in stored procedure named Project_Number and it is of varchar type.</p>
  
  <p>My Requirement is "for each project number query the table project_Number_List get results from list and insert into other table"</p>
  
  <p>Lets say, Project_Number might be like this 22,21,34,43,434
  corresponding tables I need to query is something like this 22_List, 21_List,34_List .....</p>
  
  <p>I'm using cursor to loop through the Project_Number but my problem is how to mix the project_number and _list i.e., 22_list to query the table 22_List</p>