Re: Division

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Division
Дата
Msg-id 200511041846.02733.peter_e@gmx.net
обсуждение исходный текст
Ответ на Division  (Robert Fitzpatrick <lists@webtent.net>)
Список 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 по дате отправления: