select extract(day from inter) * 24 * 60 * 60 + extract(hour from inter) * 60 * 60 + extract(minute from inter) * 60 + extract(second from inter) "seconds" from (select to_timestamp('20100115112233', 'yyyymmddhh24miss') - to_timestamp('20100101123456', 'yyyymmddhh24miss') inter from dual);