我有以下 SQL 迁移脚本,但是当我尝试插入 Varchar 'a n' 时它失败了。大写或小写并不重要,唯一重要的部分似乎是“n”是最后两个字符。当使用 Toad 和 sqlplus 手动执行时,它工作正常。
默认飞行路径占位符设置保持不变。
Flyway 版本:2.3 并使用 Ant Oracle Database 12.1.02.0 执行
CREATE TABLE TEST(
TEST VARCHAR2(40) NOT NULL
);
-- This works
INSERT INTO TEST (TEST) VALUES ( 'a b');
INSERT INTO TEST (TEST) VALUES ( 'a an');
INSERT INTO TEST (TEST) VALUES ( 'a nn');
INSERT INTO TEST (TEST) VALUES ( 'a n ');
-- This does not
INSERT INTO TEST (TEST) VALUES ( 'a n');
完整的堆栈跟踪:
build.xml:38: Flyway Error: com.googlecode.flyway.core.command.FlywaySqlScriptException: Error executing statement at line 12: INSERT INTO TEST (TEST) VALUES ( ' n');
at com.googlecode.flyway.ant.AbstractFlywayTask.execute(AbstractFlywayTask.java:331)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)
Caused by: java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1033)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1909)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1871)
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:318)
at com.googlecode.flyway.core.dbsupport.JdbcTemplate.executeStatement(JdbcTemplate.java:230)
at com.googlecode.flyway.core.dbsupport.SqlScript.execute(SqlScript.java:90)
at com.googlecode.flyway.core.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:72)
at com.googlecode.flyway.core.command.DbMigrate$2.doInTransaction(DbMigrate.java:243)
at com.googlecode.flyway.core.command.DbMigrate$2.doInTransaction(DbMigrate.java:241)
at com.googlecode.flyway.core.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72)
at com.googlecode.flyway.core.command.DbMigrate.applyMigration(DbMigrate.java:241)
at com.googlecode.flyway.core.command.DbMigrate.access$700(DbMigrate.java:44)
at com.googlecode.flyway.core.command.DbMigrate$1.doInTransaction(DbMigrate.java:186)
at com.googlecode.flyway.core.command.DbMigrate$1.doInTransaction(DbMigrate.java:135)
at com.googlecode.flyway.core.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72)
at com.googlecode.flyway.core.command.DbMigrate.migrate(DbMigrate.java:135)
at com.googlecode.flyway.core.Flyway$1.execute(Flyway.java:872)
at com.googlecode.flyway.core.Flyway$1.execute(Flyway.java:819)
at com.googlecode.flyway.core.Flyway.execute(Flyway.java:1200)
at com.googlecode.flyway.core.Flyway.migrate(Flyway.java:819)
at com.googlecode.flyway.ant.MigrateTask.doExecuteWithMigrationConfig(MigrateTask.java:162)
at com.googlecode.flyway.ant.AbstractMigrationLoadingTask.doExecute(AbstractMigrationLoadingTask.java:271)
at com.googlecode.flyway.ant.AbstractFlywayTask.execute(AbstractFlywayTask.java:329)
... 16 more