Rule on tabel

Поиск
Список
Период
Сортировка
От Markus.Schmitz
Тема Rule on tabel
Дата
Msg-id 2859652.1052474632@dbforums.com
обсуждение исходный текст
Ответы Re: Rule on tabel  (DeJuan Jackson <djackson@speedfc.com>)
Список pgsql-general
Hi their,
I want to create a rule, whenever a specific row in a table is
increased, another row is incremented.

Let's say, I have a table like this:
CREATE TABLE "test" (
  "Code" VARCHAR(20) NOT NULL,
  "Number" INTEGER NOT NULL,
  "increase" INTEGER NOT NULL,
  PRIMARY KEY("Code")
)

So, I want to have a rule (or trigger or whatever) which does the
following job:

Whenever the Number filed is updated and the new value is bigger than
the old once, the increase field should be incremented (increase++).

Can anybody tell me how to do so ?

Thanks

Markus

--
Posted via http://dbforums.com

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

Предыдущее
От: "Brian Sanders"
Дата:
Сообщение: Opposite value for RESTRICT in foreign keys?
Следующее
От: Chris Cameron
Дата:
Сообщение: MSSQL -> PostgreSQL