How to add 10 seconds in current_timestamp SQL ( Oracle )

前端 未结 2 851
庸人自扰
庸人自扰 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:27

    It can be achieved by using TO_CHAR

    Select TO_CHAR(current_timestamp,'DD-MM-YY hh24:mi:SS') AS TIMESTAMP,
    TO_CHAR(current_timestamp+10/24/60/60,'DD-MM-YY hh24:mi:SS') AS TIMESTAMP_PLUS_10SEC
    from dual;
    

    OUTPUT:

       TIMESTAMP         TIMESTAMP_PLUS_10SEC
    31-08-15 05:17:19     31-08-15 05:17:29
    

提交回复
热议问题