From: Jie Liang <jliang@ipinc.com>
To: Jyotsna Kypa <jkypa@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Need your help
Date: Fri, 23 Feb 2001 13:05:44 -0800 (PST)
Message-ID: <Pine.BSF.4.10.10102231253570.58909-100000@tidal.ipinc.com> (raw)
In-Reply-To: <20010219203401.42587.qmail@web10803.mail.yahoo.com>
e.g.
Try:
CREATE TABLE emp (
id int4 primary key,
empname text,
salary int4,
last_date datetime,
last_user name);
CREATE FUNCTION emp_stamp () RETURNS OPAQUE AS
BEGIN
update emp set last_date=''now''::timestamp where id=NEW.id;
RETURN NEW;
END;
' LANGUAGE 'plpgsql';
CREATE TRIGGER emp_stamp BEFORE UPDATE ON emp
FOR EACH ROW EXECUTE PROCEDURE emp_stamp();
Jie LIANG
St. Bernard Software
Internet Products Inc.
10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873
jliang@ipinc.com
www.stbernard.com
www.ipinc.com
On Mon, 19 Feb 2001, Jyotsna Kypa wrote:
> Hi,
> I need your help on something. I have to write a
> trigger (in sybase) that does this: Everytime a record
> gets updated it should update a column in that record
> with the current date/time. I am able to do it for the
> whole table, but how do I make sure the update happens
> only for that record which is being updated? Please
> respond.
> Thanks a bunch,
> Jyotsna.
>
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year! http://personal.mail.yahoo.com/
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: jliang@ipinc.com, jkypa@yahoo.com
Subject: Re: Need your help
In-Reply-To: <Pine.BSF.4.10.10102231253570.58909-100000@tidal.ipinc.com>
References: <20010219203401.42587.qmail@web10803.mail.yahoo.com> <Pine.BSF.4.10.10102231253570.58909-100000@tidal.ipinc.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox