From: | Ilan Fait <ilan(at)iweb(dot)com> |
---|---|
To: | "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org> |
Subject: | How to build a TRIGGER in POSTGERSQL |
Date: | 2001-06-18 14:35:42 |
Message-ID: | C9E46ACE328FD311B70200508B91AD8CA8FE9C@EXCHANGE |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Alex Pilosov | 2001-06-18 14:51:46 | Re: Inheritance: Performance & Indexes |
Previous Message | Itai Zukerman | 2001-06-18 14:30:39 | Inheritance: Performance & Indexes |