Home
Analytics
Postgresql won't allow adding to a date or timestamp
keiloon
<p>I am trying to take in two Date Time report parameters that represent a starting date and an ending date. I need to increase the ending date by 1 day so that I get all of the results including the ending date itself.</p><p> </p><p> </p><p>I have a query to a Postgres 8.1 database that says</p><p> </p><p>WHERE jobtimein >= ? and jobtimein <= Date ? + Integer '1'</p><p> </p><p>This works fine in PGADMIN and in java source code. However, when I put it in to my query in the BIRT</p><p>report that I am building, it does not work. I get the following error when I try to save the query in the Data Set:</p><p> </p><p> </p><p> org.postgresql.util.PSQLException: ERROR: syntax error at or near "$2"</p><p> Position: 609</p><p> </p><p>Any clue what I am doing wrong?</p><p> </p><p>Thanks.</p><p> </p>
Find more posts tagged with
Comments
MikeyD
<p>Have you tried to write your where clause as follows:</p><p> </p><div>WHERE [color=rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;]jobtimein[/color] >= ? and [color=rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;]jobtimein[/color] <= ?::date + 1</div>