[#2592] - Sql Syntax with comparison of Date

Category:
Bug report
Priority:
Normal
Status:
New
Project: Severity:
Minor
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:

Hi, I'm having trouble with a Report done in iReport 4.6. I have a very simple SQL that doesn't work.

The SQL is
SELECT p.apynom as apynom_prestador, a.fechatur, a.nroficha, a.apynom, a.observacion, a.osoc, a.numero
FROM "admi0001" a
inner join arcpro p on p.prestador = a.prestador
WHERE a.fechatur = $P!{fechaturno}
order by a.fechatur

And I get the next error

Error filling print... Error executing SQL statement for : turnosdia
net.sf.jasperreports.engine.JRException: Error executing SQL statement for : turnosdia      at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:246)      at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1073)      at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:667)      at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1235)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:859)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:804)      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 near «Oct»      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 net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:239)      ... 12 more 
Print not filled. Try to use an EmptyDataSource...

I'm guessing it must be a format error with the dates. I have Postgres database and the field in the DB is defined as imestamp with time zone and the parameter in the Report as Date.

The weird thing about this is that if the comparison if > the SQL works well, but when i compare with "=" I get the syntax error.

Any clues of what am i doing wrong??

Thanks in advanced,
Andres

v4.6.0
andres.achiary's picture
Joined: Nov 16 2012 - 7:54am
Last seen: 9 years 8 months ago
Feedback
randomness