title: How to use many cursors in a single store procedure in MySQL
body: <p>I want to create a store procedure that has ability to do multi-tasks. Then it got error message below</p>
  
  <p><code>Error Code: 1338 Cursor declaration after handler declaration</code></p>
  
  <p>Please look my store procedure</p>
  
  <pre><code>CREATE PROCEDURE `spTest`(OUT v1 VARCHAR(500), OUT v2 VARCHAR(500))
  BEGIN
  
      DECLARE  _cur_1 CURSOR FOR
          SELECT id
          FROM tbl_1;
      DECLARE CONTINUE HANDLER FOR NOT FOUND SET _cur1Done = 1;
  
      DECLARE  _cur_2 CURSOR FOR
          SELECT id
          FROM tbl_2;
      DECLARE CONTINUE HANDLER FOR NOT FOUND SET _cur2Done = 1;
  
      .......
  </code></pre>