pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: alla@sergey.com
To: pgsql-sql@postgresql.org
Subject: Re: How to build a TRIGGER in POSTGERSQL
Date: 18 Jun 2001 13:53:16 -0700
Message-ID: <9275d56e.0106181253.27beed20@posting.google.com> (raw)
References: <C9E46ACE328FD311B70200508B91AD8CA8FE9E@EXCHANGE>

>    CREATE SEQUENCE AD_MNG_SYS_SEQ MINVALUE 1 MAXVALUE 999999 CYCLE;
Stays pretty much the same

> 
>     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;
>    /

create function ad_mng_sys_proc()
returns opaque as '
begin
   new.ams_id := nextval(''ad_mng_sys_seq'');
 
   return new;
end;
' LANGUAGE 'plpgsql';


create trigger ad_mng_sys_trig
before insert on ad_mng_sys
for each row
execute procedure ad_mng_sys_proc();

>         2) what is  equal to 'sysdate' (to get/put the system date in a
> table)  in PostGerSQL.
now()

Enjoy :-))

Alla Gribov



view thread (4+ messages)  latest in thread

Message-ID: <9275d56e.0106181253.27beed20@posting.google.com>
Permalink:  ../9275d56e.0106181253.27beed20@posting.google.com/
Also on:    postgresql.org/message-id/9275d56e.0106181253.27beed20@posting.google.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: alla@sergey.com
  Subject: Re: How to build a TRIGGER in POSTGERSQL
  In-Reply-To: <9275d56e.0106181253.27beed20@posting.google.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox