1、Oracle日期格式ORA-01841: (full) year must be between -4713 and +9999, and not be 0
這種情況基本上就是要格式化的數據是錯的
select trunc(starttime)date1,sum(startmainqty) qty from rep_wafer_start_detail where starttime>=to_date('2020-10-10','yyyy-mm-dd') and starttime<to_date('2020-10-20','yyyy-mm-dd') and bg_id='ICBG' group by trunc(starttime) -------------錯誤日期更換-------------------- select trunc(starttime)date1,sum(startmainqty) qty from rep_wafer_start_detail where starttime>=to_date('&v_start&','yyyy-mm-dd') and starttime<to_date('&v_end&','yyyy-mm-dd') and bg_id='ICBG' group by trunc(starttime) --------------正確日期更換(VB)---------------- where starttime>=to_date('"&v_start&"','yyyy-mm-dd') and starttime<to_date('"&v_end&"','yyyy-mm-dd')
不是日期格式的數據,原因:
在進行SQL查詢時首先以固定時間帶入,再在引用程序中更換為變量,更換過程變量格式錯誤導致日期格式錯誤