format interval with to_char

前端 未结 6 701
迷失自我
迷失自我 2020-11-28 14:48

Following SQL command

select TO_CHAR(NVL(arg1 - arg2, TO_DSINTERVAL(\'0 00:00:00\'))) from table1

produces a result of the format: +0000000

6条回答
  •  醉话见心
    2020-11-28 15:20

    to_char() seems to have fixed format :( so regexp_substr may be an option, e.g.:

    SELECT regexp_substr (TO_DSINTERVAL ('10 10:00:00'), '\d{2} \d{2}:\d{2}:\d{2}\.\d{3}') t_interval FROM dual
    

提交回复
热议问题