1

我正在使用 iReport 5.0.1。我创建了一个日期参数并在我的查询中使用它:

在此处输入图像描述

当我预览报告时,我输入了我的日期参数:

在此处输入图像描述

输入所有参数并运行报告后,我收到此错误:

Error filling print... Error executing SQL statement for : Sample
net.sf.jasperreports.engine.JRException: Error executing SQL statement for : Sample 
    at com.jaspersoft.jrx.query.PlSqlQueryExecuter.createDatasource(PlSqlQueryExecuter.java:143) 
    at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1086) 
    at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:667)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1258) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:877) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:822) 
    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:61) 
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446) 
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:276) 
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:745) 
    at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:891) 
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572) 
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) 
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "Feb" 
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592) 
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327) 
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192) 
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451) 
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:350) 
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254) 
    at com.jaspersoft.jrx.query.PlSqlQueryExecuter.createDatasource(PlSqlQueryExecuter.java:136) 
    ... 12 more 
Print not filled. Try to use an EmptyDataSource...

这是怎么回事,我该如何解决?谢谢!

4

1 回答 1

0

我认为!in$P!{...}意味着在报告中包含参数的文字值。

尝试使用$P{start_date}and $P{end_date},两者都没有!.

实际上,您的 SQL 语句正在使用:

and finalinsdate >= Feb/18/2013

这不是一个有效的 SQL 语句,这意味着 PostgreSQL 会抱怨:

org.postgresql.util.PSQLException: ERROR: syntax error at or near "Feb"

下次,复制并粘贴源代码,而不是截屏。

于 2013-02-18T19:15:43.970 回答