Re: Last update/insert/delete on a table?
Date: 1998/05/27
Message-ID: <356BE93E.818E1C31_at_vsz.sk>#1/1
Hi,
You can do it with AFTER TRIGGER FOR STATEMENT, which will record datetime
and type of action to your audit table
create table audit_table_for_your_table(x varchar2(1),y date,z varchar2(100));
insert into audit_table values('I','',''); insert into audit_table values('U','',''); insert into audit_table values('D','','');
create trigger t1
after insert or update or delete
on YOUR_TABLE
begin
if inserting then
update audit_table set y=sysdate,z=user where x='I';
elsif updating then
update audit_table set y=sysdate,z=user where x='U';
elsif deleting then
update audit_table set y=sysdate,z=user where x='D';
else
raise_application_error(-20100,'Undefined action...');
end if;
end;
/
Peter.
Peter Chan wrote:
> I was wondering if there is a way to find out the date and time of when
> a table was last updated/inserted/deleted on.
>
> Thanks a bunch.
>
> --
> ====================================================================
> PETER CHAN, Northern Telecom
> PHONE: (613) 763-9096 FAX: (613) 763-4408 EMAIL: chanp_at_nortel.ca
> ====================================================================
Received on Wed May 27 1998 - 00:00:00 CEST