I'm not quite sure what your question is. The triggers can use the :OLD and :NEW keywords like this:
create trigger table1_trg
after insert or update or delete on table1
for each row
begin
if :old.col1 is null and :new.col1 is not null
or :old.col1 is not null and :new.col1 is null
or :old.col1 != :new.col1
then
insert into audit_table ...
end if;
-- Ditto for col2, col3, ...
end;
There is no generic way to do this, you will have to have code for each column. However, you can encapsulate the logic like this:
procedure log_col_change
( p_table_name varchar2
, p_column_name varchar2
, p_old_val varchar2
, p_new_val varchar2
)
is
begin
if p_old_val is null and p_new_val is not null
or p_old_val is not null and p_new_val is null
or p_old_val != p_new_val
then
insert into audit_table ...
end if;
end;
-- Overloaded version to handles DATE columns without losing time component
procedure log_col_change
( p_table_name varchar2
, p_column_name varchar2
, p_old_val date
, p_new_val date
)
is
begin
log_col_change (p_table_name, p_column_name
, to_char(p_old_val,'YYYY-MM-DD HH24:MI:SS')
, to_char(p_new_val,'YYYY-MM-DD HH24:MI:SS')
);
end;
The trigger is then:
create trigger table1_trg
after insert or update or delete on table1
for each row
begin
log_col_change ('MYTABLE', 'COL1', :old.col1, :new.col1);
log_col_change ('MYTABLE', 'COL2', :old.col2, :new.col2);
... etc.
end;
NB Best practice would be to put the procedures into a package.