Help on Trigger functions

From: "Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar(dot)Pyatalo(at)honeywell(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Help on Trigger functions
Date: 2005-03-04 11:11:38
Message-ID: 77ED2BF75D59D1439F90412CC5B109741A6419BF@ie10-sahara.hiso.honeywell.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi all,

I have a table something like this -

PointTable(PointName varchar, PointType integer, PointValue integer);

I have to write a trigger before UPDATE on this table. In the trigger
function, I need to check which field of the table is going to be
updated...based on this I need to do some operation.

CREATE FUNCTION Trg_UpdPointTable RETURNS TRIGGER AS'
BEGIN
IF PointType is being modified THEN
// do some operation.
ELSIF PointValue is being modified THEN
// Do some operation
END IF;
END;

CREATE TRIGGER PTableTrg BEFORE UPDATE ON PointTable FOR EVERY ROW EXECUTE
PROCEDURE Trg_UpdPointTable();

Is this functionality possible. I am using PostgreSQL version 7.4.3.

Thanks in advance.

Regards,
Pradeep

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Stuart Bishop 2005-03-04 12:49:11 Re: PL/Pgsql or PL/Python?
Previous Message Ross Gohlke 2005-03-04 06:27:05 Re: Form Design Advice