title: MySQL Stored Procedure returns null
body: <p>I did go through the similar questions and their answers of SO but it didn't help.
  Here is my procedure:</p>
  
  <pre><code>DELIMITER //
  DROP PROCEDURE IF EXISTS test//
  CREATE PROCEDURE test()
  BEGIN 
  DECLARE intime TIME;
  SET intime:=(SELECT intime FROM new_attendance  WHERE empid='xxx' AND DATE(dt)='2013-08-02');
  SELECT intime;
  END //
  DELIMITER ;
  </code></pre>
  
  <p>When I execute this line of code it works and returns proper value:</p>
  
  <pre><code>SELECT empid FROM new_attendance  WHERE empid='xxx' AND DATE(dt)='2013-08-02'
  </code></pre>
  
  <p>but it's not working inside procedure. i appreciate your help. Thanks a lot in advance!</p>