SET @total_no_of_columns := (select count(*) FROM information_schema.COLUMNS c where c.TABLE_NAME = 'MyTableName' and c.TABLE_SCHEMA = 'TableSchema');
SET @iCNT = 1;
WHILE @iCNT<= @total_no_of_columns DO
SET @col_name := (SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'TableSchema' AND TABLE_NAME = 'MyTableName' AND ORDINAL_POSITION = @iCNT);
IF [email protected]_name <> [email protected]_name THEN
//Query to insert in audit table
END IF;
SET @iCNT = @iCNT + 1;
END WHILE;
Mais [email protected]_name <> [email protected]_name
est faux.
Quelle devrait être la solution?Comment faire pour obtenir ANLD VALUE et NEW VALUE dynamiquement obtenir le nom de la colonne dans MySQL?
Quelle est la question? – gimg1