Re: [GENERAL] Simple math statement - problem

2007-12-02 Thread Lew
Postgres User wrote: The problem turned out to be related to my function.. Given this table: CREATE TABLE "table2" ( "s_val" numeric(6,2), "e_val" numeric(6,2) ) WITH OIDS; I am curious what would happen if you wrote your procedure like this: declare retval numeric(6,2); rec table

Re: [GENERAL] Simple math statement - problem

2007-12-02 Thread Lew
Lew wrote: Postgres User wrote: The problem turned out to be related to my function.. Given this table: CREATE TABLE "table2" ( "s_val" numeric(6,2), "e_val" numeric(6,2) ) WITH OIDS; The following functions of code will set retval = NULL; declare retval numeric(6,2); rec record; b

Re: [GENERAL] Simple math statement - problem

2007-11-30 Thread Postgres User
t; > > > -Original Message- > From: [EMAIL PROTECTED] on behalf of Gregory Williamson > Sent: Thu 11/29/2007 10:37 PM > To: Postgres User; pgsql-general > Subject: Re: [GENERAL] Simple math statement - problem > > The question: > > > &

Re: [GENERAL] Simple math statement - problem

2007-11-29 Thread Gregory Williamson
: Postgres User; pgsql-general Subject: Re: [GENERAL] Simple math statement - problem The question: > > How can I write statements that returns a decimal? > > billing=# select 1/100; ?column? -- 0 (1 row) As you said ... So make everything decimal: billing=# sele

Re: [GENERAL] Simple math statement - problem

2007-11-29 Thread Gregory Williamson
The question: > > How can I write statements that returns a decimal? > > billing=# select 1/100; ?column? -- 0 (1 row) As you said ... So make everything decimal: billing=# select 1.0/100.0; ?column? 0.0100 Or: billing=# selec

Re: [GENERAL] Simple math statement - problem

2007-11-29 Thread Ow Mun Heng
On Thu, 2007-11-29 at 21:22 -0800, Postgres User wrote: > I have a large function that's doing a number of calcs. The final > return value is wrong for a simple reason: any division statement > where the numerator is less than the denominator is returning a zero. > > Each of these statements re

[GENERAL] Simple math statement - problem

2007-11-29 Thread Postgres User
I have a large function that's doing a number of calcs. The final return value is wrong for a simple reason: any division statement where the numerator is less than the denominator is returning a zero. Each of these statements return a 0, even when properly cast: select 1/100 select Cast(1 / 10