MySQL Forums
Forum List  »  Triggers

trigger to create a log file
Posted by: andrew thompson
Date: February 06, 2006 04:14AM

Hi guys, im a newbie to creating triggers and i have a requirement to do the following.

When a record in a table is edited i.e forename is changed from andrew to andy i need a trigger that will automatically log this change to another table called db_log. The set up of the log table will be as follows:

table edited
date
id of table
user that edited
type of edit (add, modify, delete)
field\row
value before
value after

for example in the above case

customer
07/02/06
1
andrewt
modify
forename
andrew
andy

i also need it to work for an add to a table and also a delete..if anyone could help me or point me in the right direction id really appreciate it

Andy

Options: ReplyQuote


Subject
Views
Written By
Posted
trigger to create a log file
16224
February 06, 2006 04:14AM
8109
February 06, 2006 06:32PM
4418
February 07, 2006 04:15AM
4282
February 07, 2006 05:43AM
3718
February 07, 2006 07:06AM
3773
February 07, 2006 07:22AM
3370
February 07, 2006 10:28AM
3470
February 07, 2006 02:09PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.