title: Stored Procedure Output Returning Null
body: <p>I was asked to write a stored procedure that would create (INSERT) a survey response, with the SurveyGUID as an input and the SurveyResponseGUID as an output. But when I set my output after inserting the response, I return null.</p>
  
  <p>Is there  a way to set the OUT param when I perform the INSERT? </p>
  
  <p>The insert works, and the query where I set my output param works on its own when I remove the INTO part.  I've tried to find solutions but I haven't been lucky. I am new to MySQL so any help or tips would be appreciated. </p>
  
  <pre><code>
  USE db;
  DROP PROCEDURE IF EXISTS spCreateSurveyResponse;
  DELIMITER ??
  
  CREATE PROCEDURE spCreateSurveyResponse(
      IN surveyGUID varchar(36),
      OUT responseGUID varchar(36))
  BEGIN 
      SET @surveyId = ( SELECT SurveyId FROM db.Survey WHERE SurveyGuid = surveyGUID);
  
      INSERT INTO SurveyResponse (SurveyId, ResponseGuid) VALUES (@surveyId, UUID());
  
      SELECT 
          ResponseGuid INTO responseGUID
          FROM 
              db.SurveyResponse 
          WHERE 
              SurveyDetailId = last_insert_id();
  
  END ??
  
  
  DELIMITER ;
  
  -- CALL spCreateSurveyResponse('Survey GUID here', @responseGUID);
  -- SELECT @responseGUID;
  </code></pre>
  
  <p>SELECT @responseGUID always returns Null when I call the procedure from another SQL file.</p>