LMSouq
moodle-core Open

Mysql trigger to update the inserted row

GR
Grecz Balázs
1 month ago
3 views
Problem Description
I'm facing a problem: I want to update a record that being inserted to a table with trigger: DELIMITER $$ CREATE TRIGGER moodle.update_lang AFTER INSERT ON moodle.mdl_user FOR EACH ROW BEGIN update moodle.mdl_user SET lang='hu' WHERE lang='en'; END$$ DELIMITER ; So when I want to insert a row now, it gives me an error that the row can't be inserted because a procedure is already using it. Can you give any solutions how to make this work? Is this method usable or should I aproach the problem from a different angle? Thanks in advance!

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base