CREATE FUNCTION `getParentLst` (
ChildId INT
) RETURNS varchar( 1000 ) DETERMINISTIC BEGIN DECLARE sTemp VARCHAR( 1000 ) default '';
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 '' at line 5
一下是我的创建函数 代码
CREATE FUNCTION `getParentLst`(ChildId INT)
RETURNS varchar(1000)
DETERMINISTIC
BEGIN
DECLARE sTemp VARCHAR(1000) default '';
DECLARE vID INT;
DECLARE iCnt INT default 0;
set vID = ChildId;
REPEAT
select pid into vID from treenodes where id=vID;
if FOUND_ROWS() then
set sTemp=concat(sTemp,'\'',vID,'\',');
set iCnt=iCnt+1;
end if;
UNTIL not FOUND_ROWS() or iCnt>=10 END REPEAT;
if length(sTemp)>1 then
set sTemp=left(sTemp,length(sTemp)-1);
end if;
RETURN sTemp;
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 'delimiter //