Home » RDBMS Server » Server Administration » ........... Track Changes Trigger
........... Track Changes Trigger [message #150547] Thu, 08 December 2005 06:41 Go to next message
orcl_dba
Messages: 84
Registered: March 2005
Member
Problem is that we need to track the history that for a certain table which column is updated by whom.


part of code is shown below

Create of Replace trigger change
after update on table A
for each row
begin


if :old.column1<>:new.column1 then

insert into history(sequence.nextval,:old.column1,:new.column1,date)

end if;

there are 20-25 columns and for all of them one has to write this code, to check each one of them.

Does this effect performance? anybody with a better solution. I have tried using workspace manager but it shows a compelete row and user name, even if user has changed only onel column and doesnt show prerly that which column is actually changed by the user. One needs to write additional code to extract this information out.

Kindly suggest/correct the design i will be thankful to you .

Best Regards..
Re: ........... Track Changes Trigger [message #150550 is a reply to message #150547] Thu, 08 December 2005 06:46 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>> Does this effect performance?
Yes.
>> anybody with a better solution
For what you are looking to do nothing is cheap~!.
Look into auditing.

Re: ........... Track Changes Trigger [message #150553 is a reply to message #150550] Thu, 08 December 2005 06:50 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Insead of,
>> if :old.column1<>:new.column1 then

try
>> if updating then ...

Whatever, i do not prefer triggers.

Re: ........... Track Changes Trigger [message #150557 is a reply to message #150547] Thu, 08 December 2005 07:07 Go to previous messageGo to next message
orcl_dba
Messages: 84
Registered: March 2005
Member

i would like to let you know that Auditing affects the performance more than triggers.
The reason is that wheneve user logs out , the oracle server starts gathering stats as to what DML user has performed.

Triggers are better Approach, but may b anybody can make my desing better.
and secondly , when updating,, i dont feel like it will work
thnx for the reply at least...

Thankyou Verymuch,
Re: ........... Track Changes Trigger [message #150564 is a reply to message #150557] Thu, 08 December 2005 07:44 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
I do not have anything demonstrable on those now.

I strongly 'beleive', anything that can be done within oracle's default functionality(audit, workspace management/versioning) is bettter than custom mechanism.

And Tom Kyte gives a few examples that seems to be your case.!~

http://asktom.oracle.com/pls/ask/f?p=4950:8:17619848430949051456::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:59412348055
Previous Topic: database from an export
Next Topic: Migrate 8i to 9ir2 [500G data]
Goto Forum:
  


Current Time: Thu Sep 26 18:12:33 CDT 2024