title: How to create unique temporary tables in MySQL procedures?
body: <p>I was creating a temporary table in my procedure, but I always got an error "table already exists".</p>
  
  <p>Then I tried to create a random name to avoid collision but I don't know enough about how to execute SQL strings</p>
  
  <pre><code>SET @tbName = CONCAT('temp', random_id);
  
  PREPARE stmt1 FROM 'CREATE TEMPORARY TABLE ? (`FIELDNAME` float NOT NULL);';
  EXECUTE stmt1 using @tbName;
  DEALLOCATE PREPARE stmt1;
  </code></pre>
  
  <p>The code above doesn't works. Why? How to correct it?</p>