1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| WITH t AS (
SELECT
to_date(date_debut,'DD-MM-YYYY HH:MI:SS') d1,
to_date(date_fin,'DD-MM-YYYY HH:MI:SS') d2,
code_embarcation,
numero_voyage,
date_fin,
date_debut
FROM XIMARSIS.BIMV_CBITACORA)
SELECT
code_embarcation,
numero_voyage,
date_fin,
date_debut
decode(sign(d2-d1),-1,'+')||
to_char(abs(extract(day FROM ((d2 - d1) day TO second))*24 +
extract(hour FROM ((d2 - d1) day TO second))),'FM999999900')||
':'||to_char(abs(extract(minute FROM ((d2 - d1) day TO second))),'FM00')||
':'||to_char(abs(extract(second FROM ((d2 - d1) day TO second))),'FM00')
"D2-D1"
FROM t |
Partager