| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3789 人关注过本帖
标题:mysql怎么写一个带输入输出参数的用户自定义函数
只看楼主 加入收藏
system32
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:58
帖 子:3096
专家分:0
注 册:2006-9-24
收藏
 问题点数:0 回复次数:4 
mysql怎么写一个带输入输出参数的用户自定义函数

功能就如:
use studentRegisterManager

go
create function differentTime(section_id varchar(10),currenttime datetime)
returns int
begin
declare different int,
declare ttime datetime,

set ttime = (select section_set_time from [section] where section_id=@section_id)

set different=DATEDIFF( d, @time,@currenttime)

return different
end
一样

搜索更多相关主题的帖子: 函数 mysql 定义 参数 输出 
2007-11-17 15:29
purana
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:广东-广州
等 级:版主
威 望:66
帖 子:6039
专家分:0
注 册:2005-6-17
收藏
得分:0 

这个函数初步看了一下...
是错误的.


我的msn: myfend@
2007-11-17 17:06
system32
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:58
帖 子:3096
专家分:0
注 册:2006-9-24
收藏
得分:0 
回复:(purana)这个函数初步看了一下...是错误的.

我知道。我改的时候,不小心就把改动的传上来了,
use studentRegisterManager
go
create function differentTime(@section_id varchar(10),@currenttime datetime)
returns int
as
begin
declare @different int
declare @time datetime

set @time = (select section_set_time from [section] where section_id=@section_id)

set @different=DATEDIFF( d, @time,@currenttime)

return @different
end
这个对的了,能给我一个MYSQL的版本吗??


[glow=200,blue,1]世界上妞是无限的,而我们的精力是有限的,用有限去搞无限,死定了。要用有限的精力去泡一个有钱妞,要发达,吃软饭![/glow]
2007-11-17 17:40
purana
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:广东-广州
等 级:版主
威 望:66
帖 子:6039
专家分:0
注 册:2005-6-17
收藏
得分:0 

delimiter $$
drop function if exists differentTime$$
create function differentTime(in_section_id varchar(10),currenttime datetime)
returns int
begin
declare different int;
declare ttime datetime;
set ttime = (select section_set_time from section where section_id=in_section_id);

set different=to_days(currenttime)-to_days(ttime);

return different;
end $$
delimiter ;


我的msn: myfend@
2007-11-17 18:15
system32
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:58
帖 子:3096
专家分:0
注 册:2006-9-24
收藏
得分:0 
谢谢!非常感谢!

[glow=200,blue,1]世界上妞是无限的,而我们的精力是有限的,用有限去搞无限,死定了。要用有限的精力去泡一个有钱妞,要发达,吃软饭![/glow]
2007-11-17 18:37
快速回复:mysql怎么写一个带输入输出参数的用户自定义函数
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017927 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved