Received: from web111.yahoomail.com (web111.yahoomail.com [205.180.60.81]) by hub.org (8.9.3/8.9.3) with SMTP id AAA09413 for ; Wed, 24 May 2000 00:43:23 -0400 (EDT) (envelope-from jdearl@yahoo.com) Received: (qmail 7380 invoked by uid 60001); 24 May 2000 04:43:10 -0000 Message-ID: <20000524044310.7379.qmail@web111.yahoomail.com> Received: from [204.31.203.254] by web111.yahoomail.com; Tue, 23 May 2000 21:43:10 PDT Date: Tue, 23 May 2000 21:43:10 -0700 (PDT) From: Jason Earl Subject: Re: Decimal ?? To: Tubagus Nizomi , pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200005/115 In PostgreSQL 7.0 (and I would bet 6.5) if you cast either the numerator or the denominator as a numeric then it does what you would expect. For example: insert into test (name, price) values ('Jason', 3::numeric/4); OR insert into test (name, price) values ('Earl', 3/4::numeric); Will do what you want. Unfortunately: insert into test (name, price) values ('Foobar', (3/4)::numeric); does _not_ do what you would expect. This (I imagine) is because PostgreSQL sees the two values, assumes they are integers and does integer division. Without knowing exactly what you are trying to do (and what language you are trying to do it in) it is hard to guess if this is helpful, so write back if you need more help. Hopefully this is helpful. Jason --- Tubagus Nizomi wrote: > I have table : > create table test (name text, price numeric(6,2)); > CREATE > insert into test values ('John',0.75); > INSERT > > select * from test; > name | price > --------- > John | 0.75 > > but when i insert into test values ('John',3/4); > INSERT > > select * from test; > name | price > --------- > John | 0.00 ---> ??? > > why this value 0.00 but i want to 0.75 ??? help me > please. > > i am using mandrake 7 and postgres 6.5.3 > > Thanks > Nizomi __________________________________________________ Do You Yahoo!? Send instant messages & get email alerts with Yahoo! Messenger. http://im.yahoo.com/