如何将数字转换为分钟间隔?

发布于 2024-11-30 16:40:13 字数 276 浏览 4 评论 0原文

在伪 Oracle 中,我想要执行以下操作:

select systimestamp + to_interval(select NUMERIC_COLUMN from SOME_TABLE where SOME_TABLE_PK = :stuff) from dual;

如果分钟数始终相同,我可以使用间隔文字,如 interval '360' 分钟,但我找不到将数字转换为 MINUTE 间隔的简单函数。我缺少什么?

In pseudo-Oracle, I want to do the following:

select systimestamp + to_interval(select NUMERIC_COLUMN from SOME_TABLE where SOME_TABLE_PK = :stuff) from dual;

If the number of minutes were always the same, I could use an interval literal a la interval '360' minute, but I can't find a simple function to convert a number to a MINUTE interval. What am I missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

帥小哥 2024-12-07 16:40:13

您可以使用 numtodsinterval 函数正是您需要的转换(数字到间隔):

SQL> select systimestamp, systimestamp + numtodsinterval(20, 'MINUTE') from dual;

SYSTIMESTAMP              SYSTIMESTAMP+NUMTODSINTERVAL(2
------------------------- -------------------------------
2011-08-22 16:12:24.060   2011-08-22 16:32:24.060

You can use the numtodsinterval function which does exactly the conversion you need (number to interval):

SQL> select systimestamp, systimestamp + numtodsinterval(20, 'MINUTE') from dual;

SYSTIMESTAMP              SYSTIMESTAMP+NUMTODSINTERVAL(2
------------------------- -------------------------------
2011-08-22 16:12:24.060   2011-08-22 16:32:24.060
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文