Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> How to create a log file?
I want to create a log file to register changes by field in a LogTable with
the following simplified structure:
CREATE TABLE LogTable
(
TableName VARCHAR2(30) NOT NULL, KeyValue VARCHAR2(30) NOT NULL, FieldName VARCHAR2(30) NOT NULL,OldFieldValue VARCHAR2(80),
User VARCHAR2(30) NOT NULL,)+ADs-
To catch all the changes in Table1 work table, I must create a trigger after update on Table1 for each row.
But how can I write in PL/SQL the following pseudo code for the trigger?
begin
for i in +AFs-1..FieldCount+AF0- loop
if :new.Field+AFs-i+AF0-.Value +ADwAPg- :old.Field+AFs-i+AF0-.Value then
insert into LogTable values ('Table1', :new.KeyField.Value, Field+AFs-i+AF0-.Name, :old.Field+AFs-i+AF0-.Value, :new.Field+AFs-i+AF0-.Value, User)+ADs-
end if+ADs-
end loop+ADs-
end+ADs-
Tanks in advance
Fernando Carvalho Received on Tue Aug 11 1998 - 04:50:12 CDT
![]() |
![]() |