CREATE PROCEDURE `add`(tzno int,fenshu int)
begin
declare done int default 0;
declare a varchar(10);
declare cur1 cursor for select studentno from tiezibiao where tiezino=tzno;
DECLARE continue HANDLER for not found set done=1;
open cur1;
fetch cur1 into a;
if not done then
update student set integral=integral+fenshu where studentno=a;
update tiezibiao set =fenshu where tiezino=tzno;
end if;
close cur1;
end;
上面是我的一段MYSQL程序,结果发现有下面的错误:
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 'int default 0' at line 3
begin
declare done int default 0;
declare a varchar(10);
declare cur1 cursor for select studentno from tiezibiao where tiezino=tzno;
DECLARE continue HANDLER for not found set done=1;
open cur1;
fetch cur1 into a;
if not done then
update student set integral=integral+fenshu where studentno=a;
update tiezibiao set =fenshu where tiezino=tzno;
end if;
close cur1;
end;
上面是我的一段MYSQL程序,结果发现有下面的错误:
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 'int default 0' at line 3
CREATE PROCEDURE `add`(tzno int,fenshu int)
begin
declare done int default 0;
declare a varchar(10);
declare cur1 cursor for select studentno from tiezibiao where tiezino=tzno;
DECLARE continue HANDLER for not found set done=1;
open cur1;
fetch cur1 into a;
if not done then
update student set integral=integral+fenshu where studentno=a;
update tiezibiao set =fenshu where tiezino=tzno;
end if;
close cur1;
end$$
delimiter ;