Re: How to set numeric in PreparedStatement - Mailing list pgsql-jdbc

From Juhan-Peep Ernits
Subject Re: How to set numeric in PreparedStatement
Date
Msg-id Pine.GSO.4.21.0103221002380.5619-100000@suhkur.cc.ioc.ee
Whole thread Raw
In response to How to set numeric in PreparedStatement  (Aaron Brashears <gila@gila.org>)
Responses Re: How to set numeric in PreparedStatement
List pgsql-jdbc

On Wed, 21 Mar 2001, Aaron Brashears wrote:

>   PreparedStatement pstmt = connectoin.prepareStatement(
>     "select id from account where balance > ? and balance < ?";
>   pstmt.setDouble( 1, 10.0 );
>   pstmt.setDouble( 2, 100.0 );
>   ResultSet rs = pstmt.executeQuery();
>   ...
>
> And finally, the exception thrown:
>
> Exception in thread "main" java.sql.SQLException: ERROR:  Unable to identify an operator '>' for types 'numeric' and
'float8'
>         You will have to retype this query using an explicit cast
>


May be this would help?

     "select id from account where balance > ?::numeric(10,2) and
balance < ?::numeric(10,2)";


Juhan Ernits



pgsql-jdbc by date:

Previous
From: Aaron Brashears
Date:
Subject: How to set numeric in PreparedStatement
Next
From: Chris Czeyka
Date:
Subject: Lost in unicode?