Received: from exchange.iweb.co.il ([212.68.138.186]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5IF1Ia13250 for ; Mon, 18 Jun 2001 11:01:19 -0400 (EDT) (envelope-from ilan@iweb.com) Received: by EXCHANGE with Internet Mail Service (5.5.2653.19) id ; Mon, 18 Jun 2001 18:02:54 +0300 Message-ID: From: Ilan Fait To: "'pgsql-sql@postgresql.org'" Subject: How to build a TRIGGER in POSTGERSQL Date: Mon, 18 Jun 2001 18:02:54 +0300 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C0F807.C0814250" X-Archive-Number: 200106/255 X-Sequence-Number: 3513 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C0F807.C0814250 Content-Type: text/plain; charset="windows-1255" 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 ------_=_NextPart_001_01C0F807.C0814250 Content-Type: text/html; charset="windows-1255" Content-Transfer-Encoding: quoted-printable How to build a TRIGGER in POSTGERSQL

       Hi ,<= /FONT>

      I need some= help in  building  trigger and information about sysdate (System= date), any help will be appreciate. 

      1) I need t= o 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 sequen= ce and the trigger) but how you can do it in PostGer SQL)

 

   CREATE SEQUENCE AD_MNG_SYS_SE= Q MINVALUE 1 MAXVALUE 999999 CYCLE;

    CREATE TRIGGER AD_MNG_S= YS_TRIG
    BEFORE INSERT ON AD_MN= G_SYS
   REFERENCING OLD AS OLD NEW A= S NEW FOR EACH ROW
   BEGIN
   Select AD_MNG_SYS_SEQ.NEXTVA= L 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

------_=_NextPart_001_01C0F807.C0814250--