Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: problems with updates
In article <3B020C15_at_MailAndNews.com>, bryan munday <bardy_at_MailAndNews.com>
writes:
>Hello,
>
>I am having a problem trying to work out how to do the following.
>
>I have many items in a table but want to keep a record, on the table, when
>just a few of the items have been changed. It is important that the date is
>kept on the table itself if at all possible.
>
>My original idea, without thinking it through, was to place a trigger on the
>tabble, which would fire when the table was updated, and then update the
>table. As you can now see you just ends up with recurrsive firing of the
>trigger. Any method I think of using triggers causes the samne problem.
>
>I summary I need a way to update a table, when the table has been upadated.
>
>Any help is greatly appreciated.
>
>Bryan
>
>Bryan.munday_at_parexel.com
>
>
Bryan you had two other replies but one was hard to make out due to the fact
it was mostly html garbage and the other just seemed to ask what you wanted
to do so here is what you can do.
Alter table x add (last_chagned date); Create a before insert and a before update trigger on the table then code
v_sysdate date;
begin
select sysdate into v_sysdate from dual;
:NEW.last_change := v_sysdate;
end;