From: David Goodenough <david.goodenough@btconnect.com>
To: pgsql-jdbc@postgresql.org
Subject: setObject type for Interval objects
Date: Thu, 28 Jun 2007 10:58:17 +0100
Message-ID: <200706281058.19601.david.goodenough@btconnect.com> (raw)
I have an SQL SELECT which contains an expressions of the form:-
WHERE created < CURRENT_TIMESTAMP - ?
where created is a TIMESTAMP field. As a parameter I want to pass
an interval, so I used:-
PGInterval interval = new PGInterval( intervalPeriod);
stmt.setObject( 1, interval);
but Postgresql objects with:-
org.postgresql.util.PSQLException: Can't infer the SQL type to use for an
instance of org.postgresql.util.PGInterval. Use setObject() with an explicit
Types value to specify the type to use.
So I guess I need the three parameter setObject, but I do not know what
type to pass to the third parameter. I have googled, but to no avail (I
obviously asked the wrong question).
David
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: david.goodenough@btconnect.com
Subject: Re: setObject type for Interval objects
In-Reply-To: <200706281058.19601.david.goodenough@btconnect.com>
References: <200706281058.19601.david.goodenough@btconnect.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox