Search Postgresql Archives

Re: Division

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux