How to build a TRIGGER in POSTGERSQL

Поиск
Список
Период
Сортировка
От Ilan Fait
Тема How to build a TRIGGER in POSTGERSQL
Дата
Msg-id C9E46ACE328FD311B70200508B91AD8CA8FE9E@EXCHANGE
обсуждение исходный текст
Ответы Re: How to build a TRIGGER in POSTGERSQL  (darcy@druid.net (D'Arcy J.M. Cain))
Список pgsql-sql
<br /><br /><p><font face="Arial" size="2">       Hi ,</font><p><font face="Arial" size="2">      I need some help in 
building trigger and information about sysdate (System date), any help will be appreciate.  </font><p><font
face="Arial"size="2">      1) I need to build a trigger that every time I insert into the table  one of the columns
will get +1 number.</font><p><font face="Arial" size="2">           I have it in ORACLE ( see below the create of the
sequenceand the trigger) but how you can do it in PostGer SQL) </font><p><font face="Arial" size="2">  </font><p><font
face="Arial"size="2">   CREATE SEQUENCE AD_MNG_SYS_SEQ MINVALUE 1 MAXVALUE 999999 CYCLE;</font><p><font face="Arial"
size="2">   CREATE TRIGGER AD_MNG_SYS_TRIG</font><br /><font face="Arial" size="2">    BEFORE INSERT ON
AD_MNG_SYS</font><br/><font face="Arial" size="2">   REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW</font><br /><font
face="Arial"size="2">   BEGIN</font><br /><font face="Arial" size="2">   Select AD_MNG_SYS_SEQ.NEXTVAL INTO :new.AMS_ID
FROMDual;</font><br /><font face="Arial" size="2">  END;</font><br /><font face="Arial" size="2">   /</font><br
/><p><fontface="Arial" size="2">        2) what is  equal to 'sysdate' (to get/put the system date in a table)  in
PostGerSQL.</font><br/><br /><p><font face="Arial" size="2">     Thanks,</font><p><font face="Arial" size="2">    
Ilan</font>

В списке pgsql-sql по дате отправления:

Предыдущее
От: Alex Pilosov
Дата:
Сообщение: Re: Inheritance: Performance & Indexes
Следующее
От: "Josh Berkus"
Дата:
Сообщение: Better Archives?