Re: Division - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: Division
Date
Msg-id 200511041846.02733.peter_e@gmx.net
Whole thread Raw
In response to Division  (Robert Fitzpatrick <lists@webtent.net>)
List pgsql-general
Robert Fitzpatrick wrote:
> I am having a problem gettig a percent via division. Below is the
> first part of my trigger function where pct returns 0.00, instead of
> the expected 0.50. If I try without dimensions to the numeric
> variable, I just get 0. What is the correct way to accomplish the
> percent?

You are dividing an integer by an integer, and if the first integer is 1
then the result is often 0.  You need to use numeric for your noreps
variable.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

pgsql-general by date:

Previous
From: Jerry Sievers
Date:
Subject: Re: Changing ids conflicting with serial values?
Next
From: Csaba Nagy
Date:
Subject: Re: Image File System Question