Oracle (10g) 相当于 DATEADD(weekday, -3, GETDATE())
我正在寻找相当于以下内容的 Oracle (10g):
DATEADD(weekday, -3, GETDATE())
from T-SQL (SQL Server) 。这从当前日期减去 3 个工作日。我不关心假期或类似的事情(我可以自己截断时间部分)。只要排除周末就可以了。
I'm looking for the Oracle (10g) equivalent of:
DATEADD(weekday, -3, GETDATE())
from T-SQL (SQL Server) . This subtracts 3 weekdays from the current date. I'm not concerned about holidays or anything like that (and I can truncate the time part off myself). Just excluding weekends is fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
无需 PL/SQL 函数即可完成。只需根据星期几减去不同的天数:
当您必须在例如 12 天前执行此操作时,它看起来像:
请注意,星期几取决于数据库的 NLS_TERRITORY(在美国,第 1 天)是星期日,在大多数其他情况下,第一天是星期一)。
It can be done without a PL/SQL function. Just subtract a different number of days depending on the day of the week:
When you have to do this for e.g. 12 days back, it would look like:
Please note that day of week depends on the NLS_TERRITORY of your database (in America day 1 is Sunday, in most others day 1 is Monday).
看起来您需要创建一个 UDF。
由 Larry Benton 提供,来自此处。
It looks like you need to create a UDF.
Courtesy of Larry Benton, from here.