I have a table and when i make select i have results with two records. So now is ok. This result is INT. I want create function when i get each one of this value and add as string and return as string. Now i have result. What is wrong ?
pno
123 873
and after function i want
pno
123, 873, etc etc
BEGIN
DECLARE done INT DEFAULT FALSE;
declare i_myfield int;
declare abc int;
declare mycur cursor for SELECT pno FROM ptable WHERE no = no_id;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
set abc = 0;
open mycur;
read_loop: loop
fetch mycur into i_myfield;
IF done THEN
LEAVE read_loop;
END IF;
SET abc = abc + CONVERT(i_myfield, CHAR(50));
END loop;
close mycur;
return pono;
END