MySQL Forums
Forum List  »  Triggers

shorthand for trigger
Posted by: charles candy
Date: November 10, 2011 04:27AM

Hi,

I need to create trigger for all tables in the database
the trigger will write the following info to log file
-Date
-Time
-tablename
-user
-actiontype -> whether is insert,update,delete

currently this is the trigger i created . I need to repeat it for update and delete .

CREATE TRIGGER tg_logs_emp_dept_ins
AFTER INSERT ON emp_dept
FOR EACH ROW
BEGIN
INSERT INTO logs_table VALUES(
NULL,
CURDATE(),
CURTIME(),
'emp_dept',
USER(),
'INSERT');

END


any shorthand for this? I need to do for about 50 tables

Options: ReplyQuote


Subject
Views
Written By
Posted
shorthand for trigger
2254
November 10, 2011 04:27AM
889
November 11, 2011 01:46PM


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.