The code for Create_createEmailList_proc.sql is: DROP PROCEDURE IF EXISTS createEmailList; DELIMITER $$ CREATE PROCEDURE createEmailList ( INOUT emailList varchar(4000) ) BEGIN DECLARE finished INTEGER DEFAULT 0; DECLARE fn varchar(100) DEFAULT ""; DECLARE ln varchar(100) DEFAULT ""; DECLARE emailAddress varchar(100) DEFAULT ""; -- declare cursor for employee email DEClARE curEmail CURSOR FOR SELECT firstName, lastName, email FROM employees order by lastName DESC, firstName DESC; -- declare NOT FOUND handler DECLARE CONTINUE HANDLER FOR NOT FOUND SET finished = 1; OPEN curEmail; getEmail: LOOP FETCH curEmail INTO fn, ln, emailAddress; IF finished = 1 THEN LEAVE getEmail; END IF; -- build email list SET emailList = CONCAT(fn," ",ln," <",emailAddress,">; ",emailList); END LOOP getEmail; CLOSE curEmail; END$$ DELIMITER ;