Re: float formating with xx.00
От | Mark |
---|---|
Тема | Re: float formating with xx.00 |
Дата | |
Msg-id | 0HHH00B5S61MIF@VL-MO-MR001.ip.videotron.ca обсуждение исходный текст |
Ответ на | Re: float formating with xx.00 ("Dann Corbit" <DCorbit@connx.com>) |
Список | pgsql-general |
On July 3, 2003 19:26 pm, Dann Corbit wrote: > connxdatasync=# create table test (foo float); > CREATE > connxdatasync=# insert into test values(1.0); > INSERT 29128 1 > connxdatasync=# insert into test values(2.25); > INSERT 29129 1 > connxdatasync=# insert into test values(1.27); > INSERT 29130 1 > connxdatasync=# insert into test values(1.1); > INSERT 29131 1 > connxdatasync=# select * from test; > foo > ------ > 1 > 2.25 > 1.27 > 1.1 > (4 rows) > > connxdatasync=# select foo::numeric(12,2) from test; > ?column? > ---------- > 1.00 > 2.25 > 1.27 > 1.10 > (4 rows) > > But don't do it. You'll be sorry. You really, really, really want to > store money as a numeric type. Otherwise, you might find some surprises > when columns almost never add up exactly. > > IMO-YMMV Thanks... but will a numeric data type for money display the same output as the input? Ex.: I enter, 19.1 will it show 19.10 or 19.1 ? Because your select example above is making a "199" value appear like "199.00" and many user wont appreciate this... for commercial reasons. Best regards, -- Mark > > -----Original Message----- > > From: Mark [mailto:map@inter-resa.com] > > Sent: Thursday, July 03, 2003 1:29 PM > > To: pgsql-general@postgresql.org > > Subject: [GENERAL] float formating with xx.00 > > > > > > Hello, > > > > I am trying to enter 19.00 in a float field... no error but > > the data (select) > > is showing 19 without the "trailing" zeros... But for > > format and standard > > presentation of money, I need to keep any last zero digit. > > > > How can I do this? I run version 7.1x > > Thanks! > > -- > > Mark > > > > ---------------------------(end of > > broadcast)--------------------------- > > TIP 9: the planner will ignore your desire to choose an index > > scan if your > > joining column's datatypes do not match > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match
В списке pgsql-general по дате отправления: