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: Creating a Last Updated trigger

Re: Creating a Last Updated trigger

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 25 Jul 2002 00:29:56 +0200
Message-ID: <ahaujusbl10kvkddmq1avu3437fsf2duen@4ax.com>


On 24 Jul 2002 15:13:37 -0700, sean_at_kewi.net (Sean) wrote:

>On a particular table, I would like to have a column called
>"DATE_UPDATED" that notes the last time an entry was entered/modified.
> The trigger before is for a BEFORE versus an AFTER which prompts a
>question: If I am in a package and modify a record in the table
>(which causes the Trigger to fire) but I then roll back, what will the
>updated value be? The old value or the new one that the trigger
>caused? Is there a way to make an AFTER trigger? It keep giving me
>an error if I try.
>
>
>create or replace trigger trigger_request_lastUpdated
>before insert or update
>on REQUEST
>for each row
>begin
> :NEW.date_updated := SYSDATE;
>END;
>/

rollback rolls back the trigger also

You need to use
select sysdate
into :new.date_updated
from dual;

in your code

Hth

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Wed Jul 24 2002 - 17:29:56 CDT

Original text of this message

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