${if(len(start_time)=0,""," and to_char(d.CREATEDDATE,'yyyy-mm-dd')>='"+start_time+"'")}
${if(len(end_time)=0,""," and d.CREATEDDATE<='"+end_time+"'")}
上述两个都会报错,SQL命令未正确结束
请问在report里,Oracle的日期区间怎么写? PS:别纠结开始和结束为什么没用同一函数,只是懒得写!
找到问题了,非函数问题,是语句前后问题!非常感谢楼下的回答
${if(len(end_time)=0,""," and to_char(d.CREATEDDATE,'yyyy-mm-dd')<='"+end_time+"'")}
下面一个也要格式化呀。
如果是标准的日期,你这样测试看
${if(len(start_time)=0,"","and d.CREATEDDATE>=to_date('"+start_time+"','yyyy-mm-dd')")}
${if(len(end_time)=0,"","and d.CREATEDDATE<to_date('"+end_time+"','yyyy-mm-dd')+1")}
拼接好了点这个预览一下,可以看到哪里有问题
可以参考下 这个
${if(len(starttime) == 0,""," and VOUCHER_DATE between '" + starttime + "' and '" + endtime + "'")}