Data types

Started by Mihai Gheorghiuover 24 years ago3 messagesgeneral
Jump to latest
#1Mihai Gheorghiu
tanethq@earthlink.net

Would Java BigDecimal type be a good match for PG Numeric, or do I need to
look further?

Thank you all,

Mihai Gheorghiu

#2Mitch Vincent
mvincent@cablespeed.com
In reply to: Mihai Gheorghiu (#1)
Re: Data types

Numeric is just a fixed-precision type, it can handle any number (I guess?)
as long as your realize it will round the number to the precision that it
was originally set up to keep.. For instance :

brw=# create table test (test numeric(9,2));
CREATE
brw=# insert into test values (9.12345);
INSERT 2503213 1
brw=# select * from test;
test
------
9.12
(1 row)

brw=# insert into test values (9.149);
INSERT 2503214 1

brw=# select * from test;
test
------
9.12
9.15
(2 rows)

So just about any type is an OK match, as long as the above behavior is
realized and expected.

Good luck!

-Mitch

----- Original Message -----
From: "Mihai Gheorghiu" <tanethq@earthlink.net>
To: <pgsql-general@postgresql.org>
Sent: Tuesday, August 21, 2001 4:12 PM
Subject: [GENERAL] Data types

Show quoted text

Would Java BigDecimal type be a good match for PG Numeric, or do I need to
look further?

Thank you all,

Mihai Gheorghiu

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

#3Barry Lind
barry@xythos.com
In reply to: Mihai Gheorghiu (#1)
Re: Data types

FYI -- jdbc questions should go to the pgsql-jdbc mail list.

To your question, yes BigDecimal it the appropriate java data type for a
postgres numeric data type.

thanks,
--Barry

Mihai Gheorghiu wrote:

Show quoted text

Would Java BigDecimal type be a good match for PG Numeric, or do I need to
look further?

Thank you all,

Mihai Gheorghiu

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html