Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGPum-00056G-Io for pgsql-sql@arkaria.postgresql.org; Fri, 04 Oct 2019 15:54:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iGPtn-00014O-DX for pgsql-sql@arkaria.postgresql.org; Fri, 04 Oct 2019 15:53:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGPtm-00014C-PN for pgsql-sql@lists.postgresql.org; Fri, 04 Oct 2019 15:53:43 +0000 Received: from sonic313-13.consmr.mail.bf2.yahoo.com ([74.6.133.123]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iGPth-0003l6-KT for pgsql-sql@postgresql.org; Fri, 04 Oct 2019 15:53:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1570204414; bh=tETOOuDpP1riHbWD/coZTjOqYqQJLeYufnJZ09MU5Qg=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:From:Subject; b=RE/TT06dvVdQwAS8SIZUOa40RblG0rTUJHH96SqK5ZdZljdypbf8xSOlKulTNmF4KwTyzTgMbswwmDoHsO9h0OFUnXnt/bZu46xG3G5hfLgaE/iUp64DglvrRe21CjptfvEfUkxdGLUKIrkoLxJvFnhAChltLFfpJcncHswS358YwWZmTvufCDZud67p5BtOXfXSniEoNDN+GrJi+rLJhU0TxqCG308iEuW39a+7bJOjM6Pe9x0o+PH98kZioKBpEsuV9iaGt1NXjL6ysxqXdNNBOOgzRW1IfQypbmO/ZwEt6R3x/lg4/geStzSR6uix0ks8NWl9KufCuP0r3TBeYA== X-YMail-OSG: 6FCtVLEVM1lSLnVQgcYfMXN7IUwm7wqMoDJGXJK_67ORrfohOdgVpVtRe4iemuk vx9jThLsfemtfFmq4z6_oqe24rWedQXch8.T4c8r5SPK6PepO4PgXuMgQDJqaLm3Bxx5lA9Frf8R fZV0LgWqcZZlc3mBcghTaBj3e9pjs8utcfBPizvM0tvJSJKBPWnfesduM0ltVcgT6IQ2a_C3X.9V h7v77dom.YQIKCDAvVonGdNQlxnfFbLC46uFlmTvm64SbSt7yAnpiyZjwkyBTRo79LfQc0mnUbu0 qYQqGikLXs7n0ae9MlZCngwqV8FFpeMaJ8VvzUmiyWrdN1PDok5XxbalUYQhUFJ1k1q6x_fEMbWF ofelyP.X3E606rhJ.O5Jz_aWrP.DBEFlt.wBYrraArlQJ39rnY2Q9ZIvyp9eqnEeZyMkPmiDPLJh gusJ7PdKQwQKz6CxeJSB_axMxhJJ_0XFKKWqAxCbY4oLWrUTig7uuvY6CzPSGrpzkV2Fxu8M.YIJ z28vk4KETCPGYW5uEs0MQeaXp7j9YCIvVaMj1MJeHyLkIKBm.VdBWvrFQTnQlscJlS2cscwTQ3gt X2gTcTkBi9IjiVnqoIy2R3m3OHwOiLmIRHjNse5eJsD_PsIc0YJ8GDcImEsyh9D5nCIxkmEscpca L_6MBRvSbK54X9UFOMUNPM2hz7udb3jAISCfwHYinJHeZ2kcJoxlXB231dJV3xTEogoQvT2SdFG8 ZgHSjacbyRo1OyGpVwgUJiVshNjicU_raI0C2QTGS2jpcI1HY_w5usrO2sSlqEWukEIBVD7kcK1L uNqVTxIrIjWmsYhLEa7NqeDcc39MW83qZAe3pp1uriGl.V6zD_QpNDL9lLGpmPwsHiVu8yKaYQP5 6rIkV1CCPUqwVCjB_yflLNgKlTqTQwrsZ.aln9ZPRxVIRoxsmxX2qC7OtFxXVolhLrdxG7GkhKxt 8pCH1KvSvZRItGz87TnooffADe0DGqtuu5ECZ4coZYxseMwjfer9j8Sf8aGf7QRrGeoQCt.expWH 4MVYu7VKT9suEKPp7n81aldWrv5una1tleHKnMW7yp27ZgyNpowdiCvM94Ca_2UBncKz36uq_gCt cPVsVKtYPdfT1rKAfZ6JBexTR7h2.IqMzwMvlbC.QWqTelRzmZ8PGdgHEuXEz_53ahFvfIPhjLiG hARUrz4B3O.Hapg_g_8IgvEYnOY3W9OmDcgGTpN_rer3GSYY1hPTVyYhZPDVYkAJP1WfCrlRcVXI lju.gJCU0fSk7Zle0lnwEHOVY5QFgGL.76IeWD4r7lja9jobkv8SJ_4tlKO4ZAq9mKtXMgIomFHk dhrlsKNp.LpiH0I_VW.risng- Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.bf2.yahoo.com with HTTP; Fri, 4 Oct 2019 15:53:34 +0000 Date: Fri, 4 Oct 2019 15:53:32 +0000 (UTC) From: Pepe TD Vo Reply-To: Pepe TD Vo To: "Voillequin, Jean-Marc" Cc: "pgsql-sql@postgresql.org" Message-ID: <396604943.2395306.1570204412036@mail.yahoo.com> In-Reply-To: References: <744670167.2325583.1570195612720.ref@mail.yahoo.com> <744670167.2325583.1570195612720@mail.yahoo.com> Subject: Re: Automatically updating a new information column in PostgreSQL MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2395305_1754697543.1570204412032" X-Mailer: WebService/1.1.14448 YMailNorrin Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36 Content-Length: 38334 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_2395305_1754697543.1570204412032 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 1st I had both "return new" in the exception and main part. When I run inse= rt and it is still not working and when I remove it from main part, the res= ult is the same.=C2=A0=C2=A0 an expert from reddit test the script out and he informed me that the scrip= t worked fine.=C2=A0 I have test in the linux box and it worked fine too bu= t do not understand why it's not working in AWS unclassified environment. I found out that in AWS is case sensitive and recreated table with lower ca= se and voila, all worked.=C2=A0 thank you so much for looking into script and corrected my work. have a good weekend. Bach-Nga No one in this world is pure and perfect.=C2=A0 If you avoid people for the= ir mistakes you will be alone. So judge less, love and forgive more.To call= him a dog hardly seems to do him justice though in as much as he had four = legs, a tail, and barked, I admit he was, to all outward appearances. But t= o those who knew him well, he was a perfect gentleman (Hermione Gingold) **Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely = rich *** Faithful talent *** Sharing success=20 On Friday, October 4, 2019, 09:49:33 AM EDT, Voillequin, Jean-Marc wrote: =20 =20 #yiv0934717431 #yiv0934717431 -- _filtered #yiv0934717431 {font-family:Win= gdings;panose-1:5 0 0 0 0 0 0 0 0 0;} _filtered #yiv0934717431 {panose-1:2 = 4 5 3 5 4 6 3 2 4;} _filtered #yiv0934717431 {font-family:Calibri;panose-1:= 2 15 5 2 2 2 4 3 2 4;} _filtered #yiv0934717431 {font-family:Verdana;panose= -1:2 11 6 4 3 5 4 4 2 4;} _filtered #yiv0934717431 {font-family:inherit;pan= ose-1:0 0 0 0 0 0 0 0 0 0;}#yiv0934717431 #yiv0934717431 p.yiv0934717431Mso= Normal, #yiv0934717431 li.yiv0934717431MsoNormal, #yiv0934717431 div.yiv093= 4717431MsoNormal {margin:0in;margin-bottom:.0001pt;font-size:11.0pt;font-fa= mily:sans-serif;}#yiv0934717431 a:link, #yiv0934717431 span.yiv0934717431Ms= oHyperlink {color:#0563C1;text-decoration:underline;}#yiv0934717431 a:visit= ed, #yiv0934717431 span.yiv0934717431MsoHyperlinkFollowed {color:#954F72;te= xt-decoration:underline;}#yiv0934717431 p.yiv0934717431msonormal0, #yiv0934= 717431 li.yiv0934717431msonormal0, #yiv0934717431 div.yiv0934717431msonorma= l0 {margin-right:0in;margin-left:0in;font-size:11.0pt;font-family:sans-seri= f;}#yiv0934717431 p.yiv0934717431ydpea5899c81qeiagb0cpwnlhdf9xsijm, #yiv093= 4717431 li.yiv0934717431ydpea5899c81qeiagb0cpwnlhdf9xsijm, #yiv0934717431 d= iv.yiv0934717431ydpea5899c81qeiagb0cpwnlhdf9xsijm {margin-right:0in;margin-= left:0in;font-size:11.0pt;font-family:sans-serif;}#yiv0934717431 span.yiv09= 34717431ydp3b190d25yiv3811552299sg {}#yiv0934717431 span.yiv0934717431Email= Style22 {font-family:sans-serif;color:windowtext;}#yiv0934717431 .yiv093471= 7431MsoChpDefault {font-size:10.0pt;} _filtered #yiv0934717431 {margin:70.8= 5pt 70.85pt 70.85pt 70.85pt;}#yiv0934717431 div.yiv0934717431WordSection1 {= }#yiv0934717431 _filtered #yiv0934717431 {} _filtered #yiv0934717431 {font-= family:Wingdings;} _filtered #yiv0934717431 {} _filtered #yiv0934717431 {fo= nt-family:Wingdings;} _filtered #yiv0934717431 {font-family:Symbol;} _filte= red #yiv0934717431 {} _filtered #yiv0934717431 {font-family:Wingdings;} _fi= ltered #yiv0934717431 {font-family:Symbol;} _filtered #yiv0934717431 {} _fi= ltered #yiv0934717431 {font-family:Wingdings;}#yiv0934717431 ol {margin-bot= tom:0in;}#yiv0934717431 ul {margin-bottom:0in;}#yiv0934717431=20 Hello, =20 =C2=A0 =20 The function has a =E2=80=9Creturn new;=E2=80=9D in the exception part, not= in the main part. =20 A return new is probably missing after the end if; =20 =C2=A0 =20 CREATE OR REPLACE FUNCTION "ECISDRDM"."TRIGGER_FCT_TR_STG_APPLICATION_CDIM_= INS"()=C2=A0=C2=A0RETURNS trigger=C2=A0AS $$ =20 declare =20 v_ErrorCode int; v_ErrorMsg varchar(512); v_Module varchar(32) :=3D 'TR_STG_APPLICATION_CDIM_INS'; =20 begin =20 ---- =20 -- If this is an INSERT operation =20 ---- =20 if TG_OP =3D 'INSERT' then =20 =C2=A0 =C2=A0---- =C2=A0 =C2=A0-- This just ensures that the filename is not null =C2=A0 =C2=A0---- =20 =C2=A0 =C2=A0if new.mig_filename IS NULL then =C2=A0 =C2=A0 =C2=A0 new.mig_filename :=3D 'Unknown'; =C2=A0 =C2=A0end if; =20 =C2=A0 =C2=A0new.mig_insert_dt =3D current_timestamp; =20 end if; =20 /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D HERE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ =20 return new; =20 ---- -- Exception error handler ---- =20 =C2=A0 =C2=A0exception =C2=A0 =C2=A0 =C2=A0 when others then =20 =C2=A0 =C2=A0 =C2=A0 v_ErrorCode :=3D SQLSTATE; =C2=A0 =C2=A0 =C2=A0 v_ErrorMsg :=3D SQLERRM; =20 =C2=A0 =C2=A0 =C2=A0 insert into "ECISDRDM"."ERRORLOG"( "TSTAMP", "OS_USER"= , "HOST", "MODULE", "ERRORCODE",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0"ERRORMSG") =C2=A0 =C2=A0 =C2=A0 values (CURRENT_TIMESTAMP, CURRENT_USER, inet_server_a= ddr(), v_Module, v_ErrorCode, v_ErrorMsg); =20 RETURN NEW; end; $$ language 'plpgsql'; =20 =C2=A0 =20 From: Pepe TD Vo =20 Sent: Friday, October 4, 2019 3:27 PM To: Pgsql-admin ; pgsql-sql@postgresql.org Subject: Automatically updating a new information column in PostgreSQL =20 =C2=A0 =20 =C2=A0 =20 CAUTION: This email originated from outside of Moody's. Do not click links = or open attachments unless you recognize the sender and know the content is= safe. =20 =C2=A0 =20 good morning experts, =20 I have a trigger before insert (even with or update) and seem it doesnt' wo= rk.=C2=A0 The function simply sets both columns named mig_filename to "unkn= own if its null, and mig_insert_dt to current timestample for each row pass= ed to the trigger. =20 =C2=A0 =20 here is my script even I take all the rest out and just simple function wit= h new.mig_insert_dt :=3D localtimestamp; =20 =C2=A0 =20 =C2=A0 =20 =C2=A0 =20 CREATE OR REPLACE FUNCTION "ECISDRDM"."TRIGGER_FCT_TR_STG_APPLICATION_CDIM_= INS"()=C2=A0=C2=A0RETURNS trigger=C2=A0AS $$ =20 declare =20 v_ErrorCode int; v_ErrorMsg varchar(512); v_Module varchar(32) :=3D 'TR_STG_APPLICATION_CDIM_INS'; =20 begin =20 ---- =20 -- If this is an INSERT operation =20 ---- =20 if TG_OP =3D 'INSERT' then =20 =C2=A0 =C2=A0---- =C2=A0 =C2=A0-- This just ensures that the filename is not null =C2=A0 =C2=A0---- =20 =C2=A0 =C2=A0if new.mig_filename IS NULL then =C2=A0 =C2=A0 =C2=A0 new.mig_filename :=3D 'Unknown'; =C2=A0 =C2=A0end if; =20 =C2=A0 =C2=A0new.mig_insert_dt =3D current_timestamp; =20 end if; =20 ---- -- Exception error handler ---- =20 =C2=A0 =C2=A0exception =C2=A0 =C2=A0 =C2=A0 when others then =20 =C2=A0 =C2=A0 =C2=A0 v_ErrorCode :=3D SQLSTATE; =C2=A0 =C2=A0 =C2=A0 v_ErrorMsg :=3D SQLERRM; =20 =C2=A0 =C2=A0 =C2=A0 insert into "ECISDRDM"."ERRORLOG"( "TSTAMP", "OS_USER"= , "HOST", "MODULE", "ERRORCODE",=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0"ERRORMSG") =C2=A0 =C2=A0 =C2=A0 values (CURRENT_TIMESTAMP, CURRENT_USER, inet_server_a= ddr(), v_Module, v_ErrorCode, v_ErrorMsg); =20 RETURN NEW; end; $$ language 'plpgsql'; =20 CREATE TRIGGER "TR_STG_APPLICATION_CDIM_INS" BEFORE INSERT OR UPDATE ON "EC= ISDRDM"."STG_APPLICATION_CDIM" FOR EACH ROW EXECUTE PROCEDURE "ECISDRDM"."T= RIGGER_FCT_TR_STG_APPLICATION_CDIM_INS"() ; =20 I even " RAISE EXCEPTION 'UNKNOWN'; " and for the mig_insert_dt, I put eith= er '=3D' or ':=3D' Now(), now(), localtimestamp, timestamp, and none of the= m would fill the time. Both mig.filename and mig_insert_dt are still blank. =20 " =20 if new.mig_filename IS NULL then=C2=A0 =20 =C2=A0 =C2=A0 RAISE EXCEPTION 'UNKNOWN'; =20 =C2=A0 =C2=A0 new.mig_filename :=3D 'Unknown'; =20 end if; =20 new.mig_insert_dt '=3D now();=C2=A0 =C2=A0 =20 =C2=A0 =20 According to the postgres example 39-3 "shows an example of trigger procedu= re in PL/pgSQL", I don't see any different with the example and don't know = what I have missed here.=C2=A0 Would you please advise what I did wrong her= e?=C2=A0=C2=A0 =20 =C2=A0 =20 thank you, =20 =C2=A0 =20 Bach-Nga No one in this world is pure and perfect.=C2=A0 If you avoid people for the= ir mistakes you will be alone. So judge less, love and forgive more. =20 To call him a dog hardly seems to do him justice though in as much as he ha= d four legs, a tail, and barked, I admit he was, to all outward appearances= . But to those who knew him well, he was a perfect gentleman (Hermione Ging= old) =20 **Live simply **Love generously **Care deeply **Speak kindly. =20 *** Genuinely rich *** Faithful talent *** Sharing success -----------------------------------------Moody's monitors email communicat= ions through its networks for regulatory compliance purposes and to protect= its customers, employees and business and where allowed to do so by applic= able law. The information contained in this e-mail message, and any attachm= ent thereto, is confidential and may not be disclosed without our express p= ermission. If you are not the intended recipient or an employee or agent re= sponsible for delivering this message to the intended recipient, you are he= reby notified that you have received this message in error and that any rev= iew, dissemination, distribution or copying of this message, or any attachm= ent thereto, in whole or in part, is strictly prohibited. If you have recei= ved this message in error, please immediately notify us by telephone, fax o= r e-mail and delete the message and all of its attachments. Every effort is= made to keep our network free from viruses. You should, however, review th= is e-mail message, as well as any attachment thereto, for viruses. We take = no responsibility and have no liability for any computer virus which may be= transferred via this e-mail message.=20 This email was sent to you by Moody=E2=80=99s Investors Service EMEA Limite= d Registered office address: One Canada Square Canary Wharf London, E14 5FA Registered in England and Wales No: 8922701--------------------------------= --------- =20 ------=_Part_2395305_1754697543.1570204412032 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
1st I had both "return new" in the excepti= on and main part. When I run insert and it is still not working and when I = remove it from main part, the result is the same.  

an expert from reddit test the script out and he informed me that the = script worked fine.  I have test in the linux box and it worked fine t= oo but do not understand why it's not working in AWS unclassified environme= nt.

I found out that in AWS is case sensitive and recreat= ed table with lower case and voila, all worked. 

tha= nk you so much for looking into script and corrected my work.

have a good weekend.

= Bach-Nga

No one in this worl= d is pure and perfect.  If you avoid people for their mistakes you wil= l be alone. So judge less, love and forgive more.
To call him a dog hardly seems to do him justice though in as muc= h as he had four legs, a tail, and barked, I admit he was, to all outward a= ppearances. But to those who knew him well, he was a perfect gentleman (Her= mione Gingold)

**Live simply **Love generously **Care deeply **Speak kindly.
*** Genuinely rich *** Faithful talent *** Sharing = success


=20
=20
On Friday, October 4, 2019, 09:49:33 AM EDT, Voillequin= , Jean-Marc <Jean-Marc.Voillequin@moodys.com> wrote:


Hello,

=20

 

=20

The function has a =E2=80=9Creturn new;= =E2=80=9D in the exception part, not in the main part.

=20

A return new is probably missing after = the end if;

=20

 

=20

CREATE OR REPLACE FUNCTION "ECISDRDM"."TRIGGE= R_FCT_TR_STG_APPLICATION_CDIM_INS"()  RETURNS trigger AS $$<= /span>

=20

declare

=20

v_ErrorCode int;
v_ErrorMsg varchar(512);
v_Module varchar(32) :=3D 'TR_STG_APPLICATION_CDIM_INS';

=20

begin

=20

----

=20

-- If this is an INSERT operation

=20

----=

=20

if TG_OP =3D 'INSERT' then

=20

   ----
   -- This just ensures that the filename is not null
   ----

=20

   if new.mig_filename IS NULL = then
      new.mig_filename :=3D 'Unknown';
   end if;

=20

   new.mig_insert_dt =3D curren= t_timestamp;

=20

end if;

=20

/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= HERE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D*/

=20

return new;

=20

----
-- Exception error handler
----

=20

   exception
      when others then

=20

      v_ErrorCode :=3D SQL= STATE;
      v_ErrorMsg :=3D SQLERRM;

=20

      insert into "ECISDRD= M"."ERRORLOG"( "TSTAMP", "OS_USER", "HOST", "MODULE", "ERRORCODE",  &n= bsp;            "ERRORMSG")
      values (CURRENT_TIMESTAMP, CURRENT_USER, inet_server_a= ddr(), v_Module, v_ErrorCode, v_ErrorMsg);

=20

RETURN NEW;
end;
$$
language 'plpgsql';

=20

 

=20

From: Pepe TD Vo <pepevo@yaho= o.com>
Sent: Friday, October 4, 2019 3:27 PM
To: Pgsql-admin <pgsql-admin@postgresql.org>; pgsql-sql@postgr= esql.org
Subject: Automatically updating a new information column in PostgreS= QL

=20

 

=20

 

=20

CAUTION: This email originated from outside of Moody's. Do= not click links or open attachments unless you recognize the sender and know the content is safe.

=20

 

=20

good morning experts,

=20

I have a trigger before insert (even with or = update) and seem it doesnt' work.  The function simply sets both colum= ns named mig_filename to "unknown if its null, and mig_insert_dt to current timestample for each= row passed to the trigger.=

=20

 

=20

here is my script even I take all the rest ou= t and just simple function with new.mig_insert_dt :=3D localtimestamp;

=20

 

=20

 

=20

 

=20

CREATE OR REPLACE FUNCTION "ECISDRDM"."TRIGGE= R_FCT_TR_STG_APPLICATION_CDIM_INS"()  RETURNS trigger AS $$<= /span>

=20

declare

=20

v_ErrorCode int;
v_ErrorMsg varchar(512);
v_Module varchar(32) :=3D 'TR_STG_APPLICATION_CDIM_INS';

=20

begin

=20

----

=20

-- If this is an INSERT operation

=20

----=

=20

if TG_OP =3D 'INSERT' then

=20

   ----
   -- This just ensures that the filename is not null
   ----

=20

   if new.mig_filename IS NULL = then
      new.mig_filename :=3D 'Unknown';
   end if;

=20

   new.mig_insert_dt =3D curren= t_timestamp;

=20

end if;

=20

----
-- Exception error handler
----

=20

   exception
      when others then

=20

      v_ErrorCode :=3D SQL= STATE;
      v_ErrorMsg :=3D SQLERRM;

=20

      insert into "ECISDRD= M"."ERRORLOG"( "TSTAMP", "OS_USER", "HOST", "MODULE", "ERRORCODE",  &n= bsp;            "ERRORMSG")
      values (CURRENT_TIMESTAMP, CURRENT_USER, inet_server_a= ddr(), v_Module, v_ErrorCode, v_ErrorMsg);

=20

RETURN NEW;
end;
$$
language 'plpgsql';

=20

CREATE TRIGGER "TR_STG_APPLICATION_CDIM_I= NS" BEFORE INSERT OR UPDATE ON "ECISDRDM"."STG_APPLICATION_CDIM" FOR EACH R= OW EXECUTE PROCEDURE "ECISDRDM"."TRIGGER_FCT_TR_STG_APPLICATION_CDIM_INS"() ;

=20

I even " RAISE EXCEPTION 'UNKNOWN'; " and for= the mig_insert_dt, I put either '=3D' or ':=3D' Now(), now(), localtimesta= mp, timestamp, and none of them would fill the time. Both mig.filename and mig_insert_dt = are still blank.

=20

"

=20

if new.mig_filename IS NULL then =

=20

    RAISE EXCEPTION 'UNKNOWN';

=20

    new.mig_filename :=3D 'Unknown'= ;

=20

end if;

=20

new.mig_insert_dt '=3D now();   

=20

&nbs= p;

=20

Accor= ding to the postgres example 39-3 "shows an example of trigger procedure in= PL/pgSQL", I don't see any different with the example and don't know what = I have missed here.  Would you please advise what I did wrong here= ?  

=20

&nbs= p;

=20

thank= you,

=20

&nbs= p;

=20

Bach-Nga

No one in this world is pure and perfect.  I= f you avoid people for their mistakes you will be alone. So judge less, lov= e and forgive more.

=20

To call him a dog hardly= seems to do him justice though in as much as he had four legs, a tail, and= barked, I admit he was, to all outward appearances. But to those who knew him well, he was a = perfect gentleman (Hermione Gingold)

=20


**Live simply **Love generously **Care deepl= y **Speak kindly.

=20

*** Genuinely rich *** F= aithful talent *** Sharing success

=20
-----------------------------------------
Moody's monitors email c= ommunications through its networks for regulatory compliance purposes and t= o protect its customers, employees and business and where allowed to do so = by applicable law. The information contained in this e-mail message, and an= y attachment thereto, is confidential and may not be disclosed without our = express permission. If you are not the intended recipient or an employee or= agent responsible for delivering this message to the intended recipient, y= ou are hereby notified that you have received this message in error and tha= t any review, dissemination, distribution or copying of this message, or an= y attachment thereto, in whole or in part, is strictly prohibited. If you h= ave received this message in error, please immediately notify us by telepho= ne, fax or e-mail and delete the message and all of its attachments. Every = effort is made to keep our network free from viruses. You should, however, = review this e-mail message, as well as any attachment thereto, for viruses.= We take no responsibility and have no liability for any computer virus whi= ch may be transferred via this e-mail message.

This email was sent to you by Moody=E2=80=99s Investors Service E= MEA Limited
Registered office address:
= One Canada Square
Canary Wharf
London, = E14 5FA
Registered in England and Wales No: 8922701
-= ----------------------------------------
------=_Part_2395305_1754697543.1570204412032--