MySQL Forums
Forum List  »  Stored Procedures

procedures and cursors
Posted by: andrea esposito
Date: March 30, 2012 02:26PM

hi all,
i have this procedure:
delimiter $$
drop procedure if exists select_imp$$
create procedure select_imp()
BEGIN
declare output text default '';--string to print
declare matricola int(10) unsigned;
declare Nome char(20);
declare Cognome char(20);
declare Dipart char(15);
declare Ufficio char(3);
declare Stipendio decimal(9,2);
declare done int default 0;
declare imp cursor for select * from Impiegati;
declare continue handler for SQLSTATE '02000' set done=1;

open imp;

fetch imp into matricola,Nome,Cognome,Dipart,Ufficio,Stipendio;
while done do
set output=concat(matricola,',',nome,',',cognome,',',Dipart,',',Ufficio,',',Stipendio,'\n');
fetch imp into matricola,Nome,Cognome,Dipart,Ufficio,Stipendio;
select output;--should print the string output
end while;
close imp;
END$$
delimiter ;
when i call it i have no output.Could you please help me?Thank you.

Options: ReplyQuote


Subject
Views
Written By
Posted
procedures and cursors
2232
March 30, 2012 02:26PM
858
March 30, 2012 07:55AM
819
March 30, 2012 03:17PM
890
March 31, 2012 07:17AM
789
April 21, 2012 03:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.