title: Assigning variable value to out parameter in mysql
body: <p>Both insert statements are successful and inserts correctly on table <code>registration</code> and <code>registration_header</code>. My only problem is, it does not return the correct id through the <code>myOutParameter</code>.</p>
  
  <p>It's not picking up the value of <code>@var_registrationId</code> using <code>SET myOutParameter = @var_registrationId</code></p>
  
  <p>Is my syntax wrong? I know i can set it using <code>SET</code></p>
  
  <pre><code>CREATE DEFINER=`root`@`localhost` PROCEDURE `register`(IN parameter1 INT, IN parameter2 INT, OUT myOutParameter INT)
  
          BEGIN
  
          DECLARE var_registrationId INT;
          DECLARE EXIT HANDLER FOR sqlexception
              BEGIN
                  ROLLBACK;
                  RESIGNAL;
              END;
  
          START TRANSACTION;
          -- first insert to registration table which generates a Primary key auto increment id
          INSERT INTO registration(col1,col2) VALUES (parameter1, parameter2);
  
          SELECT LAST_INSERT_VALUE() INTO var_registrationId; -- id of insert on registration table
  
          insert into registration_header(registrationId,column)
          VALUES(@var_registrationId,parameter1);
  
          -- the next statement is not assigning the value of var_registrationId to the myOutParameter using SET
  
      SET myOutParameter = @var_registrationId; -- this isn't working and returns 0
  
  COMMIT;
  
      END
  </code></pre>
  
  <p>I don't know what's wrong.</p>
  
  <p>I hope you can help.</p>
  
  <p>Thanks in advance</p>