MySQL before update trigger an insert syntax error using PhpMyAdmin -


 create trigger question_preserver before update on bank  each row  begin  if trim(new.question) != trim(old.question)  insert bank_question_history (id,old_question) values (old.id,old.question)$$  end if$$  end$$ 

i inserting query mysql using phpmyadmin's sql window, using delim of $$. error you have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 5

i'm sure it's obvious , i'm missing it, no matter try can't work. error not helpful @ all, , have researched doing 4-5 examples found.

any appreciated, thank you!

go figure figured out right after asking.

 create trigger question_preserver before update on bank  each row  begin  if trim(new.question) != trim(old.question)  insert bank_question_history (id,old_question) values (old.`id`,old.`question`);  end if;  end$$ 

you have use ; break each statement/command , delim $$ end entire trigger.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -