*DELIMITER //
create procedure test(OUT l_out INT)
begin
DECLARE done INT DEFAULT FALSE;
declare l_sno INT default 0;
declare a INT default 0;
declare b INT default 0;
declare cur_1 cursor for select sno,interest from temp t where x_coord between 55 and 60 for update of interest;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
open cur_1;
read_loop: LOOP
fetch cur_1 into a,b;
if done then
Leave read_loop;
end if;
set l_sno=l_sno+1;
update temp set interest =1 where CURRENT OF cur_1;
END LOOP;
close cur_1;
set l_out=l_sno;
end //
;*
Ошибка:MYSQL курсоры, где ток
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'of interest; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; open cur_1;' at line 7
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OF cur_1; END LOOP; close cur_1; set l_out=l_sno; end' at line 16
Я думаю, что эти сообщения об ошибках в значительной степени объясняют все это, не так ли? 'OF INTEREST' и' CURRENT OF' недействительны синтаксис MySQL ... чего вы пытаетесь выполнить? – eggyal
Я хочу обновить на основе текущей позиции курсора – user1389893
Затем удалите 'OF INTEREST' и замените' CURRENT OF cur_1' на любые критерии, указывающие записи, которые вы хотите обновить. – eggyal