未知mysql存储函数语法错误

时间:2018-02-26 03:44:09

标签: mysql function

这是我的商店功能,没有编译错误,但每次执行时都会出现错误,我不知道如何解决,任何帮助都将不胜感激!

 CREATE FUNCTION splitAssociatedGene(IN associateGenes TEXT)
  RETURNS INT
  BEGIN
    DECLARE return_val INT DEFAULT 0;
    IF length(trim(associateGenes)) = 0 OR associateGenes IS NULL THEN
      SET return_val = 0;
    ELSEIF locate(associateGenes, ',') = 0 THEN
      SET return_val = 1;
    ELSE
      SET return_val = round((length(associateGenes)-length(replace(associateGenes, ',', '')))/length(','));
    END IF;
    RETURN return_val;
  END;

这是错误信息(太常见和无聊-.-):

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 'IN associateGenes TEXT)
RETURNS INT
BEGIN
DECLARE return_val INT;
' at line 1

0 个答案:

没有答案