26 lines
899 B
Markdown
26 lines
899 B
Markdown
|
|
SELECT *
|
|
FROM (SELECT SHIP_NO,
|
|
SLOT_NO,
|
|
CALL_SIGN,
|
|
SHIP_NAME
|
|
FROM MV_ARS_SHIP
|
|
WHERE SLOT_NO IS NOT NULL) A,
|
|
(SELECT FSHRBT_NO SHIP_NO,
|
|
TO_DATE (TKOFF_DE || TKOFF_TIME, 'YYYYMMDDHH24MI') OUT_DT,
|
|
TO_DATE (NVL (ETRYPT_DE, :arToDT) || NVL(CASE WHEN ETRYPT_TIME > '2359' THEN '2359' ELSE ETRYPT_TIME END, '2359' ), 'YYYYMMDDHH24MI') IN_DT
|
|
FROM TACEEZ.TB_FBB_TKOFF@TACEEZ_LINK a
|
|
WHERE TKOFF_DE IS NOT NULL
|
|
AND TKOFF_TIME IS NOT NULL
|
|
AND TKOFF_DE > '20200101'
|
|
-- AND ((TKOFF_DE <= :arFromDT AND NVL(ETRYPT_DE, '99991231') >= :arFromDT)
|
|
-- OR (TKOFF_DE <= :arToDT AND NVL(ETRYPT_DE, '99991231') >= :arToDT ) )
|
|
AND (
|
|
(TKOFF_DE >= :arFromDT AND TKOFF_DE <= :arToDT) OR
|
|
(ETRYPT_DE >= :arFromDT AND ETRYPT_DE <= :arToDT) OR
|
|
ETRYPT_DE IS null
|
|
) -- AND END
|
|
) B
|
|
WHERE A.SHIP_NO = B.SHIP_NO
|
|
ORDER BY A.SHIP_NO
|
|
|