码迷,mamicode.com
首页 > 数据库 > 详细

mysql----函数

时间:2018-03-11 22:31:16      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:body   pos   定义函数   http   iter   span   直接   href   col   

自带函数

自定义函数

创建函数‘’
delimiter \create function f1(
    i1 int,
    i2 int)
returns int
begin
    declare num int;
    set num = i1 + i2;
    return(num)
end \delimiter ;

删除函数‘’
drop function f2

执行函数
1.直接获取
select f1(11, id),name from info;
2.放到变量中
declare @i1 int
select f1(11,12) into @i1
select @i1

 

mysql----函数

标签:body   pos   定义函数   http   iter   span   直接   href   col   

原文地址:https://www.cnblogs.com/ssyfj/p/8546323.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!