On Tue, Jan 08, 2008 at 08:21:40PM +0530, kapil.munish@wipro.com wrote:
> The query is something like :
>
> DELETE from CONCURRENT_USER WHERE (now() - CONCURRENT_USER.TIME_STAMP) >
> ?
>
> Here the calculated value in '?' is not supported by the postgres as it
> was set as a double.
In postgres subtracting two timestamps produces an interval. If you
want to pass your parameter in seconds, try:
DELETE from CONCURRENT_USER WHERE (now() - CONCURRENT_USER.TIME_STAMP) > (? * '1 second'::interval)
Or if the use of indexes is important to you:
DELETE from CONCURRENT_USER WHERE CONCURRENT_USER.TIME_STAMP < (now() - (? * '1 second'::interval));
Perhaps JDBC can handle intervals itself also, that I don't know.
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
> -- John F Kennedy