Re: Numeric type - Mailing list pgsql-general

From Paul Thomas
Subject Re: Numeric type
Date
Msg-id 20050127113038.A10621@bacon
Whole thread Raw
In response to Numeric type  (phil campaigne <pcampaigne@charter.net>)
List pgsql-general
On 27/01/2005 01:06 phil campaigne wrote:
> Hi All,
> I have a double type in java that I am trying to store in postgresql as
> type numeric and it doesn't seem to like it.  The error message is,
> function double(numeric) does not exist
> unable to identify a function that satisfies the given argument type
> you may need to add explicit type casts.

use getBigDecimal()/setBigDecimal()

>
> If I just want to  store the number as 'xx.xx', is 'numeric'  the right
> postgresql type?

It depends a lot on your precision requirements and whether or not small
rounding errors matter in your application. For an accounting application,
I would recommend using numeric and using BigDecimal in your Java code. If
small rounding errors don't matter the you'll find using double precision
(int8) in the databse and double in your Java code somewhat easier.

HTH

--
Paul Thomas
+------------------------------+-------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for Business           |
| Computer Consultants         | http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+-------------------------------------------+

pgsql-general by date:

Previous
From: Miguel Angel Tribaldos Hervas
Date:
Subject: last tuple affected
Next
From: Richard Huxton
Date:
Subject: Re: last tuple affected