Rule on tabel

From: Markus(dot)Schmitz <member29397(at)dbforums(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Rule on tabel
Date: 2003-05-09 10:03:52
Message-ID: 2859652.1052474632@dbforums.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Frank Millman 2003-05-09 10:24:13 Re: How return a refcusor using functions????
Previous Message Arne Wulvik 2003-05-09 09:26:05 Cache lookup failed, and then it doesn't