我想创建一个像下面这样的简单函数来完成一项简单的任务:
DELIMITER $$
CREATE FUNCTION f(key TEXT, str TEXT) RETURNS INT
BEGIN
IF LOCATE(key, str) > 0 THEN
RETURN 1;
ELSE
RETURN 0;
END IF;
END $$
DELIMITER ;
但我得到一个错误:
ERROR 1064 (42000): 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 'key T
EXT, str TEXT) RETURNS INT
BEGIN
IF LOCATE(key, str) > 0 THEN
R' at line 1
有什么问题?