报错 Error(code = 1840, SQLState = HY000, Details = ORA-01840: input value not long enough for date format

【 使用环境 】开发环境
【 OB or 其他组件 】
【 使用版本 】4.1.1
select 字段
from 表A t,
表A t1,
表A t2,
表B t3,
表B t4
表B t5
where t与t1,t2,t3,t4,t5的关联条件
and 一些对t表的限制条件
–到此为止可以执行
and t.日期=to_char(last_day(to_date(t.日期,‘yyyymmdd’)),‘yyyymmdd’)
–加上日期这条就报错 Error(code = 1840, SQLState = HY000, Details = ORA-01840: input value not long enough for date format
单独执行
select * from 表A t where t.日期 =to_char(last_day(to_date(t.日期,‘yyyymmdd’)), ‘yyyymmdd’)也可以执行

有没有大佬可以帮忙看看这个要怎么解决

麻烦提供一下:
1、具体的OB版本:show variables like ‘version_comment’;
2、相关表的建表文本。

这个核实了一下,是数据格式不统一,解决了

怎么排查的数据有问题?