Quantcast
Channel: MySQL Forums - InnoDB
Viewing all articles
Browse latest Browse all 1957

mysql error 1064 (1 reply)

$
0
0
we are using below program,
we want to create cursor with dynamic argument passed in procedure
in this program we create cursor with inrl (inrl is parameter passed in procedure)

DROP PROCEDURE IF EXISTS getrolln;

DELIMITER //

CREATE PROCEDURE getrolln(in inrl varchar(30), in inrol int(10) )
begin
DECLARE done INT DEFAULT 0;
DECLARE xtroll int(10) default 2000;
DECLARE xformno int(10) default 0;
DECLARE a varchar(100) default 0;
DECLARE stroll int(10) default 0;
DECLARE xtable varchar(100) default 0;
set @xtable = inrl;

set @a=concat("select FORMNO from ", @xtable ," order by ATTEMPT,NAME,FNAME,MNAME");
DECLARE hs CURSOR FOR @a;

DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;



open hs;
repeat
FETCH hs into xformno;
set xtroll = xtroll + 1;
set @a=concat("update arl set ROLLNO = ",xtroll," where FORMNO = ",xformno);
PREPARE stmt FROM @a;
execute stmt;
UNTIL done END REPEAT;
close hs;
end //
DELIMITER ;

Viewing all articles
Browse latest Browse all 1957

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>