title: How do I use Liquibase to import a stored procedure into MySQL?
body: <p>I’m using Gradle 2.7, MySQL 5.5.46 and the Liquibase-Gradle 1.1.1 plugin.  I have a file with a stored procedure that looks like …</p>
  
  <pre><code>DELIMITER //
  
  DROP PROCEDURE IF EXISTS MyProc;
  
  CREATE PROCEDURE MyProc(
   IN param1 VARCHAR(25),
   IN param2 VARCHAR(5),
   OUT outParam VARCHAR(2500))
  
  BEGIN
  …
  END //
  </code></pre>
  
  <p>I’m able to import this file fine on a MySQL command line.  However, when I create this Liquibase changeset …</p>
  
  <pre><code>&lt;changeSet id="create_my_stored_proc" author="davea"&gt;
      &lt;sqlFile path="src/main/resources/scripts/my_stored_proc.sql" stripComments="true"/&gt;
  &lt;/changeSet&gt;
  </code></pre>
  
  <p>And run it, I get the error</p>
  
  <pre><code>Caused by: liquibase.exception.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'DELIMITER // 
  
  DROP PROCEDURE IF EXISTS MyProc’ at line 1
      at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316)
      at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
      at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122)
      at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1227)
      at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1210)
      at liquibase.changelog.ChangeSet.execute(ChangeSet.java:550)
      ... 126 more
  Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'DELIMITER // 
  
  DROP PROCEDURE IF EXISTS MyProc’ at line 1
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:400)
      at com.mysql.jdbc.Util.getInstance(Util.java:383)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:980)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3847)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3783)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2447)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2594)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2541)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2499)
      at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:844)
      at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:748)
      at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:314)
  </code></pre>
  
  <p>What do I need to do to correct this error?</p>
  
  <p><b>Edit:</b> I removed the “DELIMITER” line per the answer making my file look like …</p>
  
  <pre><code>DROP PROCEDURE IF EXISTS MyProd;
  
  CREATE PROCEDURE MyProc(
   IN param1 VARCHAR(25), 
   IN param2 VARCHAR(5),
   OUT outParam VARCHAR(2500))
  
  BEGIN
  …
  END //
  </code></pre>
  
  <p>However, upon running the changeset I get this error …</p>
  
  <pre><code>Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'CREATE PROCEDURE MyProc(
   IN param1 VARCHAR(25), 
   IN param2 VAR' at line 3
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:400)
      at com.mysql.jdbc.Util.getInstance(Util.java:383)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:980)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3847)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3783)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2447)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2594)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2541)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2499)
      at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:844)
      at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:748)
      at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:314)
      ... 131 more
  </code></pre>