How to fix MySQL CREATE FUNCTION query?

Posted by Liutas on Stack Overflow See other posts from Stack Overflow or by Liutas
Published on 2010-06-03T14:56:34Z Indexed on 2010/06/03 15:14 UTC
Read the original article Hit count: 332

I want to add mysql function:

CREATE FUNCTION `chf_get_translation`(translation_id INT, site_lang INT) 
RETURNS text CHARSET utf8
BEGIN

  DECLARE translation TEXT;

  SELECT title 
    INTO translation 
    FROM chf_translations 
   WHERE key_id = translation_id 
     AND lang_id = site_lang;

  RETURN translation;

END

But get error:

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 3

What can be wrong with this function?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about mysql-error-1064