Re: Exception? - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: Exception?
Date
Msg-id 009901c17c2e$3cf6c670$8201a8c0@inspiron
Whole thread Raw
In response to Exception?  (Thomas Møller Andersen <tma@tmaonline.dk>)
List pgsql-jdbc
Thomas,

The between clause really generates a query which has a >= in it. I just
tried the same thing in psql and it worked fine.

Try the query in psql and see if it works.

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Thomas Møller
Andersen
Sent: Monday, December 03, 2001 1:35 PM
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] Exception?


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;
}


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)



pgsql-jdbc by date:

Previous
From: "Dave Cramer"
Date:
Subject: Re: connection pooling for postgresql in weblogic
Next
From: "Dave Cramer"
Date:
Subject: Re: Two dimensional arrays in 7.2 JDBC driver