Обсуждение: Numeric type

Поиск
Список
Период
Сортировка

Numeric type

От
phil campaigne
Дата:
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.

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


Re: Numeric type

От
Paul Thomas
Дата:
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 |
+------------------------------+-------------------------------------------+