title: Adding dynamic value in mysql limit
body: <p>I have created a procedure, where I want to add a value in limit function dynamically, Below is my sql query, its not working, can anyone tell me, how to add it dynamically</p>
  <pre><code>CREATE PROCEDURE updateSupervisor() 
  BEGIN 
  set @counter = 0; 
  SET @v1 = &quot;some condition&quot;; 
  WHILE @counter &lt;= @v1 DO
   SET @v2 = (SELECT id FROM `employee` where DATE_ADD(last_active_date, INTERVAL 1 DAY) AND 
               DATE_ADD(last_active_date, INTERVAL 1 DAY)=CURRENT_DATE AND employee_group!=3 
               LIMIT @counter,1);
   UPDATE employee 
    SET supervisor = 1 
    WHERE id=@v2; 
   SET @counter = @counter + 1; 
  END WHILE; 
  END IF;
  END;
  </code></pre>