On inserting a record I want to trigger an update so that PGID is set to the PID prefixed with the text 'je_'.
I have tried a number of variations on a trigger to do this, eg:-
DELIMITER $$ CREATE TRIGGER `cl35-deal`.`je_PGID` AFTER INSERT ON `cl35-deal`.`je_parties` FOR EACH ROW BEGIN UPDATE `cl35-deal`.`je_parties` SET PGID = CONCAT('je_',PID); END$$DELIMITER ;
I can't get any of them to work most give me an error to do with the SQL syntax all of which I understand. The trigger above (the one I expected to work) gives me an error:-
"Error Code: 1442
Can't update table 'je_parties' in stored function/trigger because it is already used by statement which invoked this stored function/trigger."
I would appreciate help in understanding this message and in getting the trigger to work.