Re: How to set numeric in PreparedStatement

From: Juhan-Peep Ernits <juhan(at)cc(dot)ioc(dot)ee>
To: Aaron Brashears <gila(at)gila(dot)org>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: How to set numeric in PreparedStatement
Date: 2001-03-22 08:12:16
Message-ID: Pine.GSO.4.21.0103221002380.5619-100000@suhkur.cc.ioc.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Peter T Mount 2001-03-22 14:17:18 Re: patches for jdbc1 (fwd)
Previous Message Aaron Brashears 2001-03-22 07:20:56 How to set numeric in PreparedStatement