|
-
Thanks guys - what I had in mind was I'd create a new table, with 2 columns for each column in the audited table, one for the old value, one for the new, rather than 2 rows , one with old & one with new values.
So here is what I came up with:
create or replace trigger tr_aud_table
before update on schema.audit_changes
for each row
begin
insert into schema.audit_changes
(ref_number,
change_date,
user,
OLD_col1,
OLD_col2,
OLD_col3)
values
(:OLD.ref_NUMBER,
SYSDATE,
USER,
OLD:col1,
OLD:col2,
OLD:col3)
UPDATE schema.AUDIT_CHANGES
SET
NEW_col1 = NEW:col1,
NEW_col2 = NEW:col2,
NEW_col3 = NEW:col3
WHERE ref_number = OLD:ref_number
END;
will this work?
does "USER" pick up the user changing the table?
thanks again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|