Fw: Clipping values

Поиск
Список
Период
Сортировка
От Ovid
Тема Fw: Clipping values
Дата
Msg-id 859249.9789.qm@web65711.mail.ac4.yahoo.com
обсуждение исходный текст
Ответы Re: Fw: Clipping values  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
In response to a private email from someone else on this list, I thought I should send the following clarification.

I have a table with four values which are constantly lowered by user action. These four values must rise over time, in
fiveminute intervals.  The core of the function, in pseudo-code, would look something like this: 

  FOREACH row IN SELECT * FROM some_table WHERE some_percentages are less than 1
  LOOP
      new_percentage = num_intervals * .1 > 1
          ? 1
          : num_intervals * .1;
      UPDATE some_table SET some_percentages = new_percentage WHERE id = row.id
  END LOOP

But, of course, doing that for four percentages (with at least one having a different increment value than .1)

Cheers,
Ovid



В списке pgsql-general по дате отправления:

Предыдущее
От: "Tony Webb"
Дата:
Сообщение: Re: Revoking CREATE TABLE
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Revoking CREATE TABLE