Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Help w/ Trigger

Re: Help w/ Trigger

From: Marc Blum <marc_at_marcblum.de>
Date: Thu, 16 May 2002 18:07:27 GMT
Message-ID: <3ce3f4fb.10119120@news.online.de>


On 16 May 2002 11:04:18 -0700, penpendisarapen_at_yahoo.com (Victor) wrote:

>Hello,
>
>I'm a novice at this, so bear with me. I recently took a basic PL/SQL
>class, but I did not get a whole lot of examples or instructions for
>this.
>
>I need to track the date that a record was last modified, so I created
>a mod_date column in the table. I was hoping to have a trigger modify
>it each time an update is made for the row. I created the following
>trigger which doesn't seem to work:
>
>CREATE OR REPLACE TRIGGER set_bom_disp_mod_date
>BEFORE UPDATE ON bom_disposition
>FOR EACH ROW
>WHEN(NEW.mod_date IS NULL)
>BEGIN
> SELECT SYSDATE
> INTO :NEW.mod_date
> FROM dual;
>END;
>/
>
>
>Could someone tell me what I'm doing wrong? TIA!
>
>Thanks!
>
>Victor

CREATE OR REPLACE TRIGGER set_bom_disp_mod_date

   BEFORE UPDATE ON bom_disposition
   FOR EACH ROW
BEGIN
   :NEW.mod_date := SYSDATE;
END;
/
show errors

should work

regards
Marc Blum
mailto:marc_at_marcblum.de
http://www.marcblum.de Received on Thu May 16 2002 - 13:07:27 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US