How to add 10 seconds in current_timestamp SQL ( Oracle )

前端 未结 2 846
庸人自扰
庸人自扰 2020-12-06 04:47

I want to add 10 seconds to current_timestamp in my PL/SQL script. I tried below code but it\'s output is not in timestamp format.

SELECT CURREN         


        
2条回答
  •  太阳男子
    2020-12-06 05:16

    In Oracle, if you want a timestamp as the result, rather than a date (a date always includes the time to the second, though, so you may just want a date), you'd want to add an interval to the timestamp. There are various ways to construct an interval-- you can use an interval literal

    select current_timestamp + interval '10' second
      from dual
    

    or you could use the numtodsinterval function

    select current_timestamp + numToDSInterval( 10, 'second' )
      from dual
    

提交回复
热议问题