开发者

How do I a convert a number to an INTERVAL of minutes?

开发者 https://www.devze.com 2023-03-30 00:56 出处:网络
In pseudo-Oracle, I want to do the following: select systimestamp + to_interval(select NUMERIC_COLUMN from SOME_TABLE where SO开发者_运维问答ME_TABLE_PK = :stuff) from dual;

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

select systimestamp + to_interval(select NUMERIC_COLUMN from SOME_TABLE where SO开发者_运维问答ME_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?


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号