select t2.datevalue extractDate,nvl(t1.p_Consult_Num, 0) p_Consult_Num
from (
select TO_CHAR(EXTRACT_DATE, 'yyyy-mm') extractDate,sum(Consult_Num) p_Consult_Num
from Service_STATS_Tbl
where EXTRACT_DATE>=TO_DATE('2018-01-12', 'yyyy-mm-dd') and EXTRACT_DATE<= TO_DATE('2018-11-12', 'yyyy-mm-dd')
group by TO_CHAR(EXTRACT_DATE, 'yyyy-mm')
) t1,
(
SELECT TO_CHAR(ADD_MONTHS(TO_DATE(SUBSTR('2019-01-12', 1, 7), 'YYYY-MM'), ROWNUM - 1),'YYYY-MM') datevalue
FROM DUAL
CONNECT BY ROWNUM <=
MONTHS_BETWEEN(TO_DATE(SUBSTR('2019-11-12', 1, 7), 'yyyy-mm'),TO_DATE(SUBSTR('2019-01-12', 1, 7), 'yyyy-mm')) + 1
) t2
where t1.extractDate(+) = t2.datevalue
order by t2.datevalue