CREATE FUNCTION  scan(msg varchar(255))   RETURNS int   BEGIN
declare rnt int DEFAULT 0 ;
declare key1 varchar(255)
set rnt = 0;
declare fig int  DEFAULT 0 ;
declare abc cursor 
for
 select keyword from yw.dpmo_keyword;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET fig =1;
OPEN abc;
repeat;
FETCH abc INTO key1;
set rnt = locate(key1,msg);
if rnt > 0 then
set fig =1 ;
end if;
until fig =1
end repeat;
close abc;
return rnt;
end请教我上面的函数如何出错了  错误提示是
[Err] 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 'set rnt = 0;
declare fig int  DEFAULT 0 ;
declare abc cursor 
for
 select ke' at line 8