Exception?

From: Thomas Møller Andersen <tma(at)tmaonline(dot)dk>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Exception?
Date: 2001-12-03 18:34:52
Message-ID: EJECIGJMOLHOMGJCBCFHCEINCEAA.tma@tmaonline.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Does anyone have an explanation to the following exception:

Unable to identify an operator '>=' for types 'numeric' and 'float8 You will
have to retype this query using an explicit cast

The column is: numeric(10,2)

The query is from this method:

private Collection selectInRange(BigDecimal low, BigDecimal high) throws
SQLException
{
String selectStatement =
"select id from mytable " +
"where amount between ? and ?";

PreparedStatement prepStmt = con.prepareStatement(selectStatement);

prepStmt.setBigDecimal(1, low);
prepStmt.setBigDecimal(2, high);
ResultSet rs = prepStmt.executeQuery();
ArrayList a = new ArrayList();

while (rs.next()) {
String id = rs.getString(1);
a.add(id);
}

prepStmt.close();
return a;
}

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2001-12-03 18:45:10 Re: [HACKERS] JDBC improvements
Previous Message Marko Kreen 2001-12-03 18:32:32 Re: connection pooling for postgresql in weblogic