Query question.

Asked 2 years ago, Updated 2 years ago, 55 views

SELECT
        dayName,
        round(sum(REVIEW_GRADE)/count(*),1) as dayAvg
        FROM
        (
        SELECT 
        A.REVIEW_SEQ,
        A.REVIEW_DTTM,
        B.REVIEW_RATING_TYP_CCD,
        B.REVIEW_GRADE,
        TO_CHAR(TO_DATE(a.REVIEW_DTTM, 'yyyymmddHH24miss'),'DAY') as dayName,
        TO_CHAR(TO_DATE(a.REVIEW_DTTM, 'yyyymmddHH24miss'),'D') as dayNum
         FROM MTR_STORE_REVIEW a 
         LEFT JOIN MTR_STORE_REVIEW_RATING b 
         ON b.REVIEW_SEQ = a.REVIEW_SEQ AND b.REVIEW_RATING_TYP_CCD = '00' 
        WHERE MERCH_NO = 'M000000120'
        AND b.REVIEW_RATING_TYP_CCD is not null

                      AND REVIEW_DTTM BETWEEN '20141124'||'000000'  and  '20161124'||'240000'

        )GROUP BY dayName,dayNum ORDER BY dayNum;

From the above query

 AND REVIEW_DTTM BETWEEN '20141124'||'000000'  and  '20161124'||'240000'

The error message here is

ORA-01839: Invalid date for specified month
 1. 00000 -  "date not valid for month specified"

It's coming out

20141124 If you change this part to 20151114, there is no error

Is this a data problem entered?

java oracle

2022-09-22 15:46

1 Answers

There was an invalid date in the dummy data ㅠ<


2022-09-22 15:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.