1、查看是否能創建函數
show?variables?like?'%fun%';
如果為OFF,表示不能創建函數
2、修改數據庫能創建函數
set?global?log_bin_trust_function_creators?=?1;
這樣就修改為ON了,就能創建函數了
3、創建函數(機制和創建存儲過程差不多)
create?function?fun_add(a?int,b?int) returns?int begin return?a+b; end; $$;
4、調取fun_add函數
select?fun_add(2,3);
5、刪除函數
drop?function?if?exists?fun_add;
6、查看函數
show?create?function?fun_add;
?以上就是MySQL高級六——函數創建和使用的內容,更多相關內容請關注PHP中文網(www.php.cn)!
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END