SELECT a.hh24mi , NVL(b.v, 0) v FROM (-- 1. 기준 집합 SELECT TO_CHAR(TO_DATE((LEVEL-1) *20*60, 'sssss'), 'hh24:mi') hh24mi , (LEVEL-1) * 20 mi FROM dual CONNECT BY LEVEL <= 24 * 3 ) a , (-- 2. SUM 집합 SELECT FLOOR(TO_CHAR(dt, 'sssss') /60/20)*20 mi , SUM(v) v FROM t WHERE dt >= TO_DATE(:v_dt, 'yyyymmdd') AND dt < TO_DATE(:v_dt, 'yyyymmdd') + 1 GROUP BY FLOOR(TO_CHAR(dt, 'sssss') /60/20)*20 ) b WHERE a.mi = b.mi(+) -- 3. 아우터 조인 ORDER BY a.hh24mi ;