From: Ilan Fait <ilan@iweb.com>
To: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: How to build a TRIGGER in POSTGERSQL
Date: Mon, 18 Jun 2001 17:35:42 +0300
Message-ID: <C9E46ACE328FD311B70200508B91AD8CA8FE9C@EXCHANGE> (raw)
Hi ,
I need some help in building trigger and information about sysdate
(System date), any help will be appreciate.
1) I need to build a trigger that every time I insert into the table
one of the columns will get +1 number.
I have it in ORACLE ( see below the create of the sequence and
the trigger) but how you can do it in PostGer SQL)
CREATE SEQUENCE AD_MNG_SYS_SEQ MINVALUE 1 MAXVALUE 999999 CYCLE;
CREATE TRIGGER AD_MNG_SYS_TRIG
BEFORE INSERT ON AD_MNG_SYS
REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW
BEGIN
Select AD_MNG_SYS_SEQ.NEXTVAL INTO :new.AMS_ID FROM Dual;
END;
/
2) what is equal to 'sysdate' (to get/put the system date in a
table) in PostGerSQL.
Thanks,
Ilan
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: ilan@iweb.com
Subject: Re: How to build a TRIGGER in POSTGERSQL
In-Reply-To: <C9E46ACE328FD311B70200508B91AD8CA8FE9C@EXCHANGE>
* 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