I need to update media cell based on flag value after the insert trigger occurred.
My code is ...
DELIMITER $$
CREATE TRIGGER after_insert AFTER INSERT ON SampleTable
FOR EACH ROW
BEGIN
UPDATE SampleTable SET media = '../trigger/smile1.png' WHERE flag =0;
UPDATE SampleTable SET media = '../trigger/smile2.png' WHERE flag =1;
UPDATE SampleTable SET media = '../trigger/smile3.png' WHERE flag =2;
END$$
DELIMITER ;
Trigger created successfully...
But when I try to insert values, it shows the following error.
"Can't update table 'SampleTable' in stored function/trigger because it is already used by statement which invoked this stored function/trigger."
I don't understand what is the exact problem.
any help...