title: How can I insert value in mysql stored procedure after select statement
body: <p>I am new to stored procedure and i appreciate if someone can help me!</p>
  <p>I am trying to search for an email in table and if the email exists then it eill return the email and username, if it doesn't exist then it shall insert the email in the db, but the insert part is not working, below is my code but not sure what  i am doing wrong here - there are no errors or anything it is just don't insert to table:</p>
  <pre><code>CREATE PROCEDURE InsertMnualUser(IN mail char(40))
  BEGIN
  DECLARE Mvar char(40);
  SELECT user_email INTO Mvar 
  from AppUsers WHERE user_email=mail;
  IF @Mvar IS NULL
  THEN
  INSERT INTO AppUsers(user_email, username) 
  values(mail,&quot;username&quot;); &lt;=================
  ELSE
  SELECT user_email, username 
  from AppUsers WHERE user_email=mail;
  END IF;
  END//
  DELIMITER ;
  </code></pre>