MySQL Forums
Forum List  »  Stored Procedures

Column values into one delimited field
Posted by: Francesco Facco de Lagarda
Date: June 14, 2012 08:06AM

Hello all,
i'm trying to implement change management on a number of tables (who changes what when). I was thinking of doing it using triggers ON BEFORE INSERT, UPDATE, and DELETE ad writing to a changes table to have the following schema
uID - Unique Id of record
userId - id of user making change
timeStamp - timestamp of change
tableName - name of table being modified (i.e. friends)
Operation - operation : INSERT/UPDATE/DELTE
FieldList - table fieldList, eg friendID, firstName, lastName, email
ValuesBefore 1,'John','Sliver','js@me.com'
ValuesAfter 1,'John','Sterling Silver', 'johnny@microsoft.tw'

I can probably get a delimited fieldName list from:

SELECT GROUP_CONCAT(COLUMN_NAME) cols
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'myDb'
AND TABLE_NAME = 'friends'
ORDER BY ORDINAL_POSITION

but my question is HOW to get the value lists (for the before and after records)?

Options: ReplyQuote


Subject
Views
Written By
Posted
Column values into one delimited field
2071
June 14, 2012 08:06AM


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.