我有一个日期字符串为yyyy-mm-dd格式的列。如何检索日期<= 90天的所有行。某些条目的日期字符串为null。其中一些日期字符串的格式也不正确。这就是我的尝试。
select * from MY_TABLE where b.ASSESSMENT_DATE IS NOT NULL AND (trunc(sysdate) - TO_date(b.ASSESSMENT_DATE, 'yyyy-mm-dd')) <= 90;
但它给了我一个错误
ORA-01841: (full) year must be between -4713 and +9999, and not be 0
01841. 00000 - "(full) year must be between -4713 and +9999, and not be 0"
*Cause: Illegal year entered
*Action: Input year in the specified range