Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f5KGiVa93161 for ; Wed, 20 Jun 2001 12:44:31 -0400 (EDT) (envelope-from pgsql-sql-owner@postgresql.org) Received: from exchange.iweb.co.il ([212.68.138.186]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5IEYBa99079 for ; Mon, 18 Jun 2001 10:34:12 -0400 (EDT) (envelope-from ilan@iweb.com) Received: by EXCHANGE with Internet Mail Service (5.5.2653.19) id ; Mon, 18 Jun 2001 17:35:43 +0300 Message-ID: From: Ilan Fait To: "'pgsql-sql@postgresql.org'" Subject: How to build a TRIGGER in POSTGERSQL Date: Mon, 18 Jun 2001 17:35:42 +0300 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C0F803.F40BAC90" X-Archive-Number: 200106/319 X-Sequence-Number: 3600 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_01C0F803.F40BAC90 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_01C0F803.F40BAC90 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_01C0F803.F40BAC90--