title: How to select table Dynamically on Mysql store procedure
body: <p>Hey i was trying to  write a code to check the record existence  from many tables, 
  Is there any way to give table names dynamically?</p>
  
  <p>what i am upto see below code</p>
  
  <pre><code>DELIMITER $$
  
  DROP PROCEDURE IF EXISTS `_relatives` $$
  CREATE PROCEDURE `_relatives`(
    IN db_database VARCHAR(55),
    IN db_table VARCHAR(55),
    IN db_column_no VARCHAR(55),
    IN _id INT(15),
    OUT last_inserted_id INT(15)
  )
  BEGIN
  
   IF ( SELECT EXISTS (SELECT 1 FROM CONCAT(' ', db_table, ' ') WHERE CONCAT('`', db_column_no, '`')= CONCAT(' ', _id, ' ') ) )
   THEN 
              SELECT 'data';
  ELSE
              SELECT 'No data';
     END IF; 
  
     SET last_inserted_id = LAST_INSERT_ID();
  
  END $$
  </code></pre>
  
  <p>DELIMITER ;</p>
  
  <p>i code is not working .. please help thanks in advance</p>