10

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?

Hank Gay
  • 70,339
  • 36
  • 160
  • 222

1 Answers1

18

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
Vincent Malgrat
  • 66,725
  • 9
  • 119
  • 171