1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| SELECT w.*, suiv-dte, INTERVAL '2' SECOND
FROM (
SELECT dte, lead(dte, 1) OVER (ORDER BY dte) suiv
FROM (
SELECT TO_TIMESTAMP('25.06.2018 09:15:21.854952', 'DD.MM.RRRR HH24:MI:SS.FF6') dte FROM dual
UNION ALL SELECT TO_TIMESTAMP('25.06.2018 09:15:21.896452', 'DD.MM.RRRR HH24:MI:SS.FF6') dte FROM dual
UNION ALL SELECT TO_TIMESTAMP('25.06.2018 09:15:22.845101', 'DD.MM.RRRR HH24:MI:SS.FF6') dte FROM dual
UNION ALL SELECT TO_TIMESTAMP('25.06.2018 09:15:25.120124', 'DD.MM.RRRR HH24:MI:SS.FF6') dte FROM dual
UNION ALL SELECT TO_TIMESTAMP('25.06.2018 09:16:22.120124', 'DD.MM.RRRR HH24:MI:SS.FF6') dte FROM dual)
) w
where suiv-dte < interval '2' SECOND
DTE SUIV SUIV-DTE INTERVAL'2'SECOND
25/06/2018 09:15:21.854952000 25/06/2018 09:15:21.896452000 +00 00:00:00.041500 +00 00:00:02.000000
25/06/2018 09:15:21.896452000 25/06/2018 09:15:22.845101000 +00 00:00:00.948649 +00 00:00:02.000000 |