WITH T(DT) AS ( SELECT SYSDATE - (1/24) * 1 FROM DUAL UNION ALL SELECT SYSDATE - (1/24) * 2 FROM DUAL UNION ALL SELECT SYSDATE + (1/24) * 0.5 FROM DUAL UNION ALL SELECT SYSDATE + (1/24) * 1 FROM DUAL UNION ALL SELECT SYSDATE + (1/24) * 2 FROM DUAL UNION ALL SELECT SYSDATE + (1/24) * 3 FROM DUAL UNION ALL SELECT SYSDATE + (1/24) * 4 FROM DUAL ) SELECT DT , CASE WHEN DT < SYSDATE + (1/24) * 1 AND DT >= SYSDATE + (1/24) * 0.5 THEN '1' WHEN DT >= SYSDATE + (1/24) * 1 THEN 'N' END GUBN FROM T ;