# Error when declaring mysql trigger

**URL:** <https://forum.liquibase.org/t/error-when-declaring-mysql-trigger/224>\
**Category:** General Discussion\
**Created:** [September 4, 2009, 7:25pm UTC](https://forum.liquibase.org/t/error-when-declaring-mysql-trigger/224 "2009-09-04T19:25:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hopfrog\_lb](https://avatars.discourse-cdn.com/v4/letter/h/6bbea6/32.png) [@hopfrog\_lb](https://forum.liquibase.org/u/hopfrog_lb)\
**Post date:** [September 4, 2009, 7:25pm UTC](https://forum.liquibase.org/t/error-when-declaring-mysql-trigger/224/1 "2009-09-04T19:25:00Z")

</div>

When I have a changeset with a element, whose contents are:

CREATE TRIGGER `partner_trg` AFTER UPDATE ON `partner` FOR EACH ROW begin &nbsp; &nbsp; &nbsp; IF NEW.demo\_state = true THEN update portal set is\_active = false where partner\_id = NEW.id; &nbsp; &nbsp; &nbsp; END IF; &nbsp; &nbsp; &nbsp; end;

Liquibase (v 1.9.3) reports:

" Error setting up or running Liquibase: Migration failed for change set … Caused By: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 2"

I’ve taken the same string and executed it via JDBC, so I’m quite certain the syntax is correct.&nbsp; Has anyone experienced anything similar?&nbsp; Are there strategies for dealing with this problem?

I’m evaluating liquibase to handle our project.&nbsp; Although we have only a couple triggers, if Liquibase is unable to handle them, I’ll have to eliminate it as a candidate (even though there are some features I really like).

Thank you,

~hf

Has anyone had to do anything similar?&nbsp; Is

---

<div class="post-metadata">

**Author:** ![hopfrog\_lb](https://avatars.discourse-cdn.com/v4/letter/h/6bbea6/32.png) [@hopfrog\_lb](https://forum.liquibase.org/u/hopfrog_lb)\
**Post date:** [September 4, 2009, 7:25pm UTC](https://forum.liquibase.org/t/error-when-declaring-mysql-trigger/224/2 "2009-09-04T19:25:00Z")

</div>

I ended up using the element.&nbsp; For anyone who encounters a similar issue, I also had to ensure the&nbsp; endDelimiter and splitStatements attributes defined, set to “” and “false” respectively.

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [September 4, 2009, 7:25pm UTC](https://forum.liquibase.org/t/error-when-declaring-mysql-trigger/224/3 "2009-09-04T19:25:00Z")

</div>

Glad you found that. You should be able to use with the splitStatements=“false” attribute as well.&nbsp; The reason is that JDBC requires you to pass in one statement at a time, it cannot have the database parse statements apart, so we do a split on ;'s by default.&nbsp; Setting splitStatents=“false” will stop if from doing that and send the whole trigger to the database at once.

Nathan
