For example if rest 01/01/2017 19:30:00 - 01/01/2017 22:30:30
, in the output should appear 3 horas y 30 segundos
This is what I have tried but it does not return it with the format I want, it returns the values of the date separated in the columns, when trying to put everything together in a column (the commented column) I got this error:
ORA-00904: "FECHA_UNO": identificador no válido
SELECT FECHA_UNO,
FECHA_DOS,
TRUNC((FECHA_DOS - FECHA_UNO)) DIFERENCIA_DIAS,
TRUNC((FECHA_DOS - FECHA_UNO) * (24)) DIFERENCIA_HORAS,
TRUNC((FECHA_DOS - FECHA_UNO) * (60 * 24)) DIFERENCIA_MINUTOS,
TRUNC((FECHA_DOS - FECHA_UNO) * (60 * 60 * 24)) DIFERENCIA_SEGUNDOS
-- TRUNC((FECHA_DOS - FECHA_UNO) - (FECHA_DOS - FECHA_UNO (24)) - (FECHA_DOS - FECHA_UNO *(24*60)) -(FECHA_DOS - FECHA_UNO *(24*60*60)) ) DIFERENCIA_TOTAL
FROM (
SELECT TO_DATE('&1', 'DD.MM.YYYY HH24:MI:SS') FECHA_UNO,
TO_DATE('&2', 'DD.MM.YYYY HH24:MI:SS') FECHA_DOS
FROM DUAL
);