mysql创建自定义函数
2013-12-20 17:15
801 查看
DELIMITER $$
CREATE FUNCTION `new_function` ()
RETURNS INTEGER
BEGIN
RETURN 1;
END
红色句子很关键
delimiter $$是设置 $$为命令终止符号,代替分号,因为分号在begin...end中会用到;
否则;号部分要报错。
出错信息大致类似:
ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
建立不了函数,是未开启功能:
在mysql中启动函数创建开关:
mysql>set global log_bin_trust_function_creators=1;
相关文章推荐
- mysql 报错之创建自定义函数
- mysql创建自定义函数和存储过程
- 深入mysql创建自定义函数与存储过程的详解
- MySQL存储过程和自定义函数、Navicat for mysql、创建存储过程和函数、调用存储过程和函数的区别
- 深入mysql创建自定义函数与存储过程的详解
- MySQL 创建自定义函数
- mysql函数的创建以及hibernate调用mysql自定义函数以及数据对比功能,模仿中关村在线
- Mysql创建自定义函数
- mysql创建自定义函数
- MySQL创建自定义函数时 Error Code: 1418 的解决方法
- Mysql Query Browser下创建存储过程和自定义函数
- mysql创建自定义函数与存储过程
- MySQL 创建自定义函数(1)
- mysql里创建自定义函数---将某字段以逗号分割并取出第一个数据
- MySQL存储过程和自定义函数、Navicat、创建存储过程和函数、调用存储过程和函数、三种方式、In和Out类型参数、
- 22- mysql不能创建自定义函数
- mysql在centos上创建自定义函数报错。
- mysql创建自定义函数
- MySQL 自定义和函数