Re: Numeric type

From: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>
To: phil campaigne <pcampaigne(at)charter(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Numeric type
Date: 2005-01-27 11:30:38
Message-ID: 20050127113038.A10621@bacon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 |
+------------------------------+-------------------------------------------+

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2005-01-27 11:34:18 Re: last tuple affected
Previous Message Rogério A Bassete 2005-01-27 11:21:55 complete instruction in trigger?