Error Code: 1418. 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)
代码:
use test;
delimiter //
create function get_stu_count()
returns integer
begin
return(
select count(*) from student);
end //
delimiter ;
执行时遇到错误
0 | 27 | 10:46:51 | create function get_stu_count() returns integer begin return( select count(*) from student); end | Error Code: 1418. 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) | 0.000 sec |
如果没有语法错误,需要使用如下代码解决:
set global log_bin_trust_function_creators=TRUE;