SELECT TO_CHARto_datedeliverydate yyyymmdd YYYY-MM AS month TO_CHARto_datedeliverydate yyyymmdd IW AS week COUNT AS count FROM PRESALES_HOLIDAY_ORDER WHERE TO_CHARto_datedeliverydate yyyymmdd D IN 6 7
This error occurs because the input value for the date format is not long enough. It is likely that the 'deliverydate' column in the PRESALES_HOLIDAY_ORDER table is not in the correct format.
To fix this error, you can try changing the date format in the TO_CHAR function to match the format of the 'deliverydate' column. For example, if the 'deliverydate' column is in the format 'YYYY/MM/DD', you can use the following query:
SELECT TO_CHAR(to_date(deliverydate, 'YYYY/MM/DD'), 'YYYY-MM') AS month, TO_CHAR(to_date(deliverydate, 'YYYY/MM/DD'), 'IW') AS week, COUNT(*) AS count FROM PRESALES_HOLIDAY_ORDER WHERE TO_CHAR(to_date(deliverydate, 'YYYY/MM/DD'), 'D') IN ('6', '7') GROUP BY TO_CHAR(to_date(deliverydate, 'YYYY/MM/DD'), 'YYYY-MM'), TO_CHAR(to_date(deliverydate, 'YYYY/MM/DD'), 'IW') ORDER BY month, week;
Make sure to adjust the date format in the TO_DATE function to match the format of the 'deliverydate' column in your table.
原文地址: https://www.cveoy.top/t/topic/b4dv 著作权归作者所有。请勿转载和采集!