pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yudha Setiawan <yudha@BonBon.net>
To: pgsql-admin@postgresql.org
Subject: Do Something before Abort on Trigger ???
Date: Wed, 15 Jan 2003 16:08:40 +0700
Message-ID: <023f01c2bc75$bdce13b0$ea00a8c0@yudha> (raw)

Somebody gimme your hand plz.

Using my previous Database I used to be like that;
" ALTER TRIGGER tr_T_DtlPO ON dbo.T_DtlPO FOR UPDATE AS
  bla..bla..bla...
  IF @OldQty <> @NewQty BEGIN
     ROLLBACK
     INSERT INTO T_My_ListError(fc_code,fv_descript) 
               VALUES('12345','No Authority to Change Qty')
  END"
So I'v already write the error code to table T_My_ListError before aborting this session
-----------------------------------------------------------------------------------------
And I Tried on Postgre like that;
" create or replace function fn_tr_t_dtlpo returns trigger as'
  begin
     bla..bla...;
     if new.fn_qty != old.fn_qty then 
        raise exception ''Error 12345'';
        insert into t_my_listerror(fc_code,fv_descript) 
                 values(''12345'',''No Authority to Change Qty'');
     end if;
  end;' language 'plpgsql';
"
But I Couldn't get any records at all on t_my_listerror. Even when put the insert statement
(insert into t_my_listerror...bla..bla) before raise exception.

Some advice will be very helpfull to me. Thank's a lot and ...
GOD Bless You All.

view thread (6+ messages)  latest in thread

Message-ID: <023f01c2bc75$bdce13b0$ea00a8c0@yudha>
Permalink:  ../023f01c2bc75$bdce13b0$ea00a8c0@yudha/
Also on:    postgresql.org/message-id/023f01c2bc75$bdce13b0$ea00a8c0@yudha

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: yudha@BonBon.net
  Subject: Re: Do Something before Abort on Trigger ???
  In-Reply-To: <023f01c2bc75$bdce13b0$ea00a8c0@yudha>
  References: <023f01c2bc75$bdce13b0$ea00a8c0@yudha>

* 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