Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Creating a Last Updated trigger
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
![]() |
![]() |