I have created a stored procedure to insert data into an audit table. The procedure accepts an argument that takes table name and same value is inserted into the audit table along with PK. When i’m calling this stored procedure from AFTER DELETE trigger, from multiple tables it is inserting duplicate values. Basically, same PK […]
- Tags column_value VARCHAR(255)) BEGIN INSERT .... END$$ CREATE TRIGGER tr_table_ad AFTER DELETE ON table_name FOR EACH ROW CALL sp_ins_log('tab, from multiple tables it is inserting duplicate values. Basically, I have created a stored procedure to insert data into an audit table. The procedure accepts an argument that takes table name and same value, if i delete a record from a table, if i put the same insert query individually in each trigger, it works fine, number of inserts in audit table for single delete = number of triggers. CREATE PROCEDURE sp_ins_log( trigger_name VARCHAR(64), old.id); But, same PK value is getting inserted for all table names in the audit table. So