Title: How to build a TRIGGER in POSTGERSQL


       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 via email to