计算营业日 [英] Calculating Business Days

查看:60
本文介绍了计算营业日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人知道某个功能(系统或用户定义)将会计算工作日?例如:我在表格中有一个列

称为DATE。我希望能够在这个日期增加五个工作日

并提出一个新的约会。这是可能的。


另外,有没有DB2可以知道假期?也许在某种类型的参考文件或其他东西上将它们加载到服务器上。


我问这些问题,因为我正在处理银行应用程序和

这些是我们要克服的两个主要障碍。


任何帮助都将不胜感激。


谢谢!

解决方案

听起来像是编写自己的usder定义函数的工作。

这篇文章可能是一个地方开始:

http://www-106.ibm.com/developerwork.../0211yip3.html

Anthony Robinson写道:

是否有人知道将计算工作日的功能(系统或用户定义)?例如:我在表格中有一个名为DATE的列。我希望能够在那个日期增加五个工作日
并提出一个新的约会。这是可能的吗?

此外,DB2是否可以了解假期?也许在某种类型的参考文件或其他东西上将它们加载到服务器上。

我问这些问题,因为我正在处理银行应用程序并且
这些是两个主要的我们要克服障碍。

任何帮助都将不胜感激。

谢谢!



an*****@yahoo.com (Anthony Robinson)在留言中写道:< d1 * *************************@posting.google。 com> ...

< snip>

我问这些问题是因为我正在开发银行应用程序并且
这些是两个主要的障碍我们要克服。




你可以创建一个时间维度表。这些通常用在数据集市中的
star-schemas中,但也提供了一些像你所描述的oltp

情况。时间维度将比一个需要计算

本月的第一个星期六等的程序更快,并且更容易维护。


典型的实现涉及日期的主键,

描述日期的非键属性。在仓库中,你可能会比使用代理键(或者时间戳等)更多地使用代理键,但是

这只是一个实现细节。然后你可以编写存储的

程序来访问这个表,如果你想把它封装在API后面的




ken


Ken:


不要成为一个mooch,但是你能告诉我这是怎么回事吗? />
实施了吗?以前曾经使用过日期尺寸,但是我正在抓住你所指的这个概念。


任何进一步的见解都会是非常感谢。


谢谢!


" Ken" <柯****** @ yahoo.com>在消息中写道

新闻:ea ************************** @ posting.google.c om ...

an*****@yahoo.com (Anthony Robinson)在留言中写道
news:< d1 ************************** @ posting.google。 com> ...< snip>

我问这些问题是因为我正在处理银行应用程序,这是我们要克服的两个主要障碍。


您可以创建时间维度表。这些通常用于数据集市中的星型模式,但也可以像你描述的那样在oltp
情况下提供一些价值。与需要计算一个月的第一个星期六等的程序相比,时间维度更快并且更易于维护。

典型的实现将涉及日期的主键,具有描述日期的非键属性。在仓库中,您可能会使用代理键而不是日期(或时间戳等),但这只是一个实现细节。如果你想在API后面封装它,你也可以编写存储的
程序来访问这个表。

ken



Is anyone aware of a function (system or user defined) that will
calculate business days? For instance: I have a column in as table
called DATE. I want to be able to add five business days to that date
and come up with a new date. Is that possible.

Also, is there anyway that DB2 can be aware of holidays? Maybe load
them onto the server in some type of reference file or something.

I ask these questions because I''m working on a banking application and
these are two MAJOR hurdles for us to get over.

Any help would be appreciated.

Thanks!

解决方案

Sounds like a job for writing your own usder-defined functions.
This article might be a place to start:

http://www-106.ibm.com/developerwork.../0211yip3.html

Anthony Robinson wrote:

Is anyone aware of a function (system or user defined) that will
calculate business days? For instance: I have a column in as table
called DATE. I want to be able to add five business days to that date
and come up with a new date. Is that possible.

Also, is there anyway that DB2 can be aware of holidays? Maybe load
them onto the server in some type of reference file or something.

I ask these questions because I''m working on a banking application and
these are two MAJOR hurdles for us to get over.

Any help would be appreciated.

Thanks!




an*****@yahoo.com (Anthony Robinson) wrote in message news:<d1**************************@posting.google. com>...
<snip>

I ask these questions because I''m working on a banking application and
these are two MAJOR hurdles for us to get over.



You could create a time dimension table. These are commonly used in
star-schemas in data marts, but also provide some value in oltp
situations like you''re describing. The time dimension would be faster
and easier to maintain than a procedure that needed to calculate
"first saturday of the month", etc.

A typical implementation would involve a primary key of date, with
non-key attributes describing the date. In a warehouse you''d be more
likely to use a surrogate key than date (or timestamp, etc), but
that''s just an implementation detail. You could then also write stored
procedures that would access this table if you want to encapsulate it
behind an API.

ken


Ken:

Not to be a mooch, but could you give me an idea of how this would be
implemented? ''ve worked with date dimensions before, but am having a hard
time grasping the consept you''re referring to.

Any further insight would be greatly appreciated.

thanks!

"Ken" <ke******@yahoo.com> wrote in message
news:ea**************************@posting.google.c om...

an*****@yahoo.com (Anthony Robinson) wrote in message news:<d1**************************@posting.google. com>... <snip>

I ask these questions because I''m working on a banking application and
these are two MAJOR hurdles for us to get over.



You could create a time dimension table. These are commonly used in
star-schemas in data marts, but also provide some value in oltp
situations like you''re describing. The time dimension would be faster
and easier to maintain than a procedure that needed to calculate
"first saturday of the month", etc.

A typical implementation would involve a primary key of date, with
non-key attributes describing the date. In a warehouse you''d be more
likely to use a surrogate key than date (or timestamp, etc), but
that''s just an implementation detail. You could then also write stored
procedures that would access this table if you want to encapsulate it
behind an API.

ken



这篇关于计算营业日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆