日期:2014-05-16 浏览次数:20813 次
mysql> CREATE FUNCTION hello (s CHAR(20)) RETURNS CHAR(50) -> RETURN CONCAT('Hello, ',s,'!'); Query OK, 0 rows affected (0.00 sec) mysql> SELECT hello('world'); +----------------+ | hello('world') | +----------------+ | Hello, world! | +----------------+ 1 row in set (0.00 sec)
------解决方案--------------------
完整的
set global log_bin_trust_function_creators = 1; DELIMITER $$ DROP FUNCTION IF EXISTS `hello`$$ CREATE DEFINER=`root`@`%` FUNCTION `hello`() RETURNS varchar(50) CHARSET utf8 begin return concat('Hello!'); end$$ DELIMITER ;