title: How can I define the a stored procedure that return values in mysql
body: <p>I want to define a function as stored procedure in MySQL.</p>
  
  <p>I tried a procedure as follows:</p>
  
  <pre><code>DELIMITER //
  CREATE PROCEDURE getGroupUsers(IN groupId int) return curser
  
  BEGIN
   Declare services_curs cursor for SELECT `service_id`,`service_name`,`service_type_value`,`service_label`,`parent`,`service_group` from services;
  
  open services_curs;
  
  return services_curs;
  
  END //
  
  DELIMITER ;
  </code></pre>
  
  <p>but an error occurs:</p>
  
  <pre><code>#1313 - RETURN is only allowed in a FUNCTION
  </code></pre>
  
  <p>I know that this is a terrible syntax error. What is the correct syntax?</p>