select a.*,nvl(b.report_value,0) report_value from ss_report_item_t a ,(
select REPORT_ITEM,sum(REPORT_VALUE) report_value from ss_month_report_t
where to_char(REPORT_DATE,'yyyy-mm') = to_char(to_date(#beginDate#,'yyyy-mm'),'yyyy-mm')
group by REPORT_ITEM
) b
where a.report_item = b.report_item(+)
and REPORT_TYPE = 2 and if_valid in (1,2)
出错:date format picture ends before converting entire input string 其中REPORT_DATE是Oracle的date字段 beginDate是abitas中的传来的字符串!
select REPORT_ITEM,sum(REPORT_VALUE) report_value from ss_month_report_t
where to_char(REPORT_DATE,'yyyy-mm') = to_char(to_date(#beginDate#,'yyyy-mm'),'yyyy-mm')
group by REPORT_ITEM
) b
where a.report_item = b.report_item(+)
and REPORT_TYPE = 2 and if_valid in (1,2)
出错:date format picture ends before converting entire input string 其中REPORT_DATE是Oracle的date字段 beginDate是abitas中的传来的字符串!
为什么不使用
REPORT_DATE>=to_date(#beginDate#,'yyyy-mm')
and REPORT_DATE<= last_day(to_date(#beginDate#,'yyyy-mm') );
楼主已经知道问题在哪了,还想问什么呢?
楼主修改一下 where 条件where to_char(REPORT_DATE,'yyyy-mm') = #beginDate#这样,就算传过来的字符串不符合日期格式,最多也就是查不出数据,不会报错