title: SQL loop get a null value
body: <p>In the next portion of code i used a cursor and a loop to generate a list of users who match the search query,
  but i get a <code>null</code> value, why ?</p>
  
  <pre><code>BEGIN
      DECLARE finished INTEGER DEFAULT 0;
      DECLARE ids TEXT;
      DECLARE response TEXT;
      DECLARE ids_cursor CURSOR FOR
          SELECT id 
          FROM user WHERE email LIKE CONCAT('%',value,'%') 
          OR lastname LIKE CONCAT('%',value,'%') 
          OR name LIKE CONCAT('%',value,'%');
      DECLARE CONTINUE HANDLER FOR NOT FOUND SET finished = 2;
  
      OPEN ids_cursor;
      get_ids: LOOP
  
          FETCH ids_cursor INTO ids;
  
          IF finished = 2 THEN
              LEAVE get_ids;
          END IF;
  
          SET response = CONCAT(ids,";",response);
  
      END LOOP get_ids;
      CLOSE ids_cursor;
  
      RETURN response;
  END
  </code></pre>