Вы должны добавить предложение GROUP BY
, чтобы указать столбцы, по которым вы группируете:
SELECT
TO_CHAR(PAID_DATE, 'YEAR') "YEAR",
TO_CHAR(PAID_DATE, 'MONTH') "MONTH",
SUM(CASE WHEN TO_CHAR(PAID_DATE, 'D') >= '1' AND TO_CHAR(PAID_DATE, 'DD') <=7 THEN TOTAL_PAID ELSE 0 END) "MINGGU1",
SUM(CASE WHEN TO_CHAR(PAID_DATE, 'D') >= '8' AND TO_CHAR(PAID_DATE, 'DD') <=15 THEN TOTAL_PAID ELSE 0 END) "MINGGU2",
SUM(CASE WHEN TO_CHAR(PAID_DATE, 'D') >= '16' AND TO_CHAR(PAID_DATE, 'DD') <=23 THEN TOTAL_PAID ELSE 0 END) "MINGGU3",
SUM(CASE WHEN TO_CHAR(PAID_DATE, 'D') >= '24' THEN TOTAL_PAID ELSE 0 END) "MINGGU4"
FROM
PAID_TABLE
GROUP BY TO_CHAR(PAID_DATE, 'YEAR'), TO_CHAR(PAID_DATE, 'MONTH') -- added line