title: Multiple Inserts in Temporary Table MYSQL
body: <p>Trying to execute 3 insert commands in MySQL temporary Table in Stored Procedure but select command shows only first insert was executed/inserted.</p>
  
  <pre><code> CREATE TEMPORARY TABLE IF NOT EXISTS OtDates (OtDatesList Date, TotalOTMinutes int);
  
  #Fist Insert
      insert into OtDates(OtDatesList,TotalOTMinutes) values('2017-04-15', 400);
  #Second Insert    
      insert into OtDates(OtDatesList,TotalOTMinutes) values(@DateOtHalf, @TotalOTMinutesHalf);
  #Third Insert   
      insert into OtDates(OtDatesList,TotalOTMinutes) values(@DateOtFull, @TotalOTMinutesFull);
  </code></pre>
  
  <p>Select command returns only 2017-04-15, 400 while values from variables in 2nd and 3rd insert are not listed. If I remove the first insert command, the second one gets inserted and not the third one.</p>
  
  <p>EDIT 2 : </p>
  
  <p>Providing complete stored procedure</p>
  
  <pre><code>CREATE DEFINER=`root`@`localhost` PROCEDURE `Test0`()
  begin
  
  
  select @DateOtHalf:=DateofIn, @TotalOTMinutesHalf:=TotalOTMinutes from hrtpunch where TotalOTMinutes &gt;= @ExtraWorkHalfDayInMin and TotalOTMinutes &lt; @ExtraWorkFullDayInMin and EmpID = P_EmpID;
  
  select @DateOtFull:=DateofIn, @TotalOTMinutesFull:=TotalOTMinutes  from hrtpunch where TotalOTMinutes &gt;= @ExtraWorkFullDayInMin and EmpID = P_EmpID;
  
  
  
  CREATE TEMPORARY TABLE IF NOT EXISTS OtDates (OtDatesList Date, TotalOTMinutes int);
  
  
  
  #Fist Insert
      insert into OtDates(OtDatesList,TotalOTMinutes) values('2017-04-15', 400);
  #Second Insert    
      insert into OtDates(OtDatesList,TotalOTMinutes) values(@DateOtHalf, @TotalOTMinutesHalf);
  #Third Insert   
      insert into OtDates(OtDatesList,TotalOTMinutes) values(@DateOtFull, @TotalOTMinutesFull);
  
      select * from OtDates;
  
  
   end
  </code></pre>
  
  <p>EDIT 3 : Providing Sample Data and Table Structure from "hrtpunch"</p>
  
  <p>Create Statement</p>
  
  <pre><code>CREATE TABLE `hrtpunch` (
    `ID` int(11) NOT NULL AUTO_INCREMENT,
      `TotalOTMinutes` int(11) DEFAULT NULL,
     PRIMARY KEY (`ID`)
  ) ENGINE=InnoDB AUTO_INCREMENT=464 DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>Sample Data Insert</p>
  
  <pre><code>insert into hrtpunch (TotalOTMinutes) values(61);
  insert into hrtpunch (TotalOTMinutes) values(600);
  insert into hrtpunch (TotalOTMinutes) values(301);
  insert into hrtpunch (TotalOTMinutes) values(0);
  </code></pre>
  
  <p>And Int Values returned for  ExtraWorkHalfDayInMin is 160 and ExtraWorkFullDayInMin is 240</p>