WITH t AS ( SELECT TO_TIMESTAMP('2023/01/02 14:54:23.610', 'yyyy/mm/dd hh24:mi:ss.ff') sdt , TO_TIMESTAMP('2023/01/02 16:24:43.830', 'yyyy/mm/dd hh24:mi:ss.ff') edt FROM dual ) SELECT sdt , edt , TO_CHAR(EXTRACT(hour FROM edt - sdt), 'fm00') h , TO_CHAR(EXTRACT(minute FROM edt - sdt), 'fm00') m , TO_CHAR(EXTRACT(second FROM edt - sdt), 'fm00') s , SUBSTR(edt - sdt, 12, 8) hms , edt - sdt interval_ FROM t ;