From: | Barry Lind <blind(at)xythos(dot)com> |
---|---|
To: | Vicente Alabau Gonzalvo <vicente(dot)alabau-gonzalvo(at)cgey(dot)com> |
Cc: | PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Data types |
Date: | 2003-02-06 20:49:42 |
Message-ID: | 3E42CA66.3070603@xythos.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Vicente,
You either need to upgrade the server to 7.3 (where this has been
fixed), or change your sql to use an explicit cast.
String query = "SELECT * FROM types WHERE _numeric_= cast(? as numeric)";
thanks,
--Barry
Vicente Alabau Gonzalvo wrote:
> Hello,
>
> I'm trying to retireve some data from this table:
>
> create table types (_numeric_ numeric);
>
> _numeric_
> -----------
> 10
> (1 row)
>
> usgin jdbc in this way:
>
> If I try to do this query:
> String query = "SELECT * FROM types";
> I can get it as BigDecimal and gives me no problems.
>
> But with this other:
>
> String query = "SELECT * FROM types WHERE _numeric_=? ";
> pStmt = con.prepareStatement(query);
> pStmt.setBigDecimal(1, 10);
>
> and java gives this exception:
>
> java.sql.SQLException: ERROR: Unable to identify an operator
> '=' for types 'numeric' and 'double precision'
>
> I think it's because jdbc matches BigDecimals with 'double precision'
> but I want to match them with 'numeric' instead.
>
>
> Is there any way to do this match? How can I solve this problem?
> Thanks
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
From | Date | Subject | |
---|---|---|---|
Next Message | tania gutierrez | 2003-02-06 21:13:56 | Type of variable in poststoneware exists algun, that allows to copy a file from another equipment |
Previous Message | Joseph Shraibman | 2003-02-06 20:05:57 | .NoClassDefFoundError after upgrade from 7.3.1 to 7.3.2 |