아래쿼리를 실행시키면 아래 오류가 발생합니다 UNION ALL 을 기준으로 따로따로 쿼리를 날리면
실행이 잘되는데 전체를 돌리면 아래 에러가 발생하내요 고수님들 좀 봐주세요~ ㅠ.ㅠ
ora-24347 : 함수 관계에 있는 null 열에 경고가 있습니다
SELECT TFN_NO,
TFN_SEQ,
TFN_GUBUN,
TFN_PART,
TFN_TITLE,
TFN_SABUN,
TFN_DATE,
TFN_READ_COUNT,
TFN_VISIBLE,
TFN_LEVEL,
TFN_COUNT,
TFN_FILE
FROM (SELECT "TBF_NOTICE"."TFN_NO" TFN_NO,
"TBF_NOTICE"."TFN_SEQ" TFN_SEQ,
"TBF_NOTICE"."TFN_GUBUN" TFN_GUBUN,
"TBF_NOTICE"."TFN_PART" TFN_PART,
"TBF_NOTICE"."TFN_TITLE" TFN_TITLE,
"TBF_NOTICE"."TFN_SABUN" TFN_SABUN,
"TBF_NOTICE"."TFN_DATE" TFN_DATE,
"TBF_NOTICE"."TFN_READ_COUNT" TFN_READ_COUNT,
DECODE("TBF_NOTICE"."TFN_VISIBLE", 'Y', 'Y', 'N') TFN_VISIBLE,
1 TFN_LEVEL,
'[0]' TFN_COUNT,
0 TFN_FILE
FROM "TBF_NOTICE"
WHERE "TBF_NOTICE"."TFN_PART" = 'NO' AND
"TBF_NOTICE"."TFN_DATE" >= SYSDATE - 7
UNION ALL
SELECT A."TFN_NO" TFN_NO,
A."TFN_SEQ" TFN_SEQ,
A."TFN_GUBUN" TFN_GUBUN,
A."TFN_PART" TFN_PART,
A."TFN_TITLE" TFN_TITLE,
A."TFN_SABUN" TFN_SABUN,
A."TFN_DATE" TFN_DATE,
A."TFN_READ_COUNT" TFN_READ_COUNT,
DECODE(A."TFN_VISIBLE", 'Y', 'N', 'N') TFN_VISIBLE,
A.TFN_LEVEL TFN_LEVEL,
'[' || TO_CHAR(SUM(NVL(B.TFN_COUNT, 0))) || ']' TFN_COUNT,
NVL(SUM(C.TFN_FILE), 0) TFN_FILE
FROM (SELECT E."TFN_NO" ,
E."TFN_SEQ",
E."TFN_GUBUN",
E."TFN_PART",
E."TFN_TITLE",
E."TFN_SABUN",
E."TFN_DATE",
E."TFN_READ_COUNT",
E."TFN_VISIBLE",
LEVEL TFN_LEVEL
FROM "TBF_NOTICE" E
START WITH E."TFN_SEQ" = 1
CONNECT BY PRIOR E."TFN_SEQ" = E."TFN_UPPER_SEQ"
AND PRIOR E."TFN_NO" = E."TFN_NO") A,
(SELECT D."TFNR_NO" ,
D."TFNR_SEQ",
COUNT(D."TFNR_NO") TFN_COUNT
FROM "TBF_NOTICE_REPLY" D
GROUP BY D."TFNR_NO", D."TFNR_SEQ") B,
(SELECT F."TFNF_NO" ,
F."TFNF_SEQ",
COUNT(F."TFNF_NO") TFN_FILE
FROM "TBF_NOTICE_FILE" F
GROUP BY F."TFNF_NO", F."TFNF_SEQ") C
WHERE A."TFN_NO" = B."TFNR_NO" (+) AND
A."TFN_SEQ" = B."TFNR_SEQ" (+) AND
A."TFN_NO" = C."TFNF_NO" (+) AND
A."TFN_SEQ" = C."TFNF_SEQ" (+)
GROUP BY A."TFN_NO",
A."TFN_SEQ",
A."TFN_GUBUN",
A."TFN_PART",
A."TFN_TITLE",
A."TFN_SABUN",
A."TFN_DATE" ,
A."TFN_READ_COUNT",
A."TFN_VISIBLE",
A.TFN_LEVEL
ORDER BY A."TFN_NO" DESC)