title: Procedure different tables into IF
body: <p>I want to select a table according to the value received per parameter. Would there be possibility of doing it similar to my code? Thank you.</p>
  
  <p>/*PROCEDURE */</p>
  
  <pre><code>BEGIN
      DECLARE text varchar(30);
  
      IF (type = 1) THEN  
          SET text = 'table1';
      ELSEIF (type  = 2) THEN
          SET text = 'table2';        
      ELSEIF (type  = 3) THEN
          SET text = 'table3';        
      ELSEIF (type  = 4) THEN
          SET text = 'table4';                
      END IF;
  
      Select * from text where `fee type` = var2;
  
  END
  </code></pre>