MySQL Forums
Forum List  »  Triggers

CREATE TRIGGER FOR ALL / Journaled Table
Posted by: StuFF mc
Date: August 04, 2005 04:39AM

I'm a huge fan of triggers... You can do a lot of things with them. Some things are anyway stupid to implement in triggers, like "journaled" tables. Let's see, I got in a bunch of my tables 4 fields:

Created TimeStamp default current_timestamp;
CreatedBy varchar(32)
Updated DateTime
UpdatedBy varchar(32)

I guess you see what I need it for... Unfortunately there is no way (that I know) to implement the 3 last with default. I don't know of a default implement User() (or Current_User), and you cannot have 2 timestamp columns with default in a table...

So , if there is no way of having "journaled" tables, keeping tracks of who changed what when, it would be cool to have triggers applying to all tables. The same trigger could, for example, fill in a "journal table". Of course you'll say I can call a SP. Of course, but as NEW is a Trigger keyword, it won't work without making it too much complicated.

Anybody seing another solution than my current one ?

Options: ReplyQuote


Subject
Views
Written By
Posted
CREATE TRIGGER FOR ALL / Journaled Table
5825
August 04, 2005 04:39AM


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.