从Flyway调用Oracle程序

时间:2012-12-11 15:55:20

标签: oracle flyway

我在Java应用程序中使用Maven 3,FlyWay和Oracle。我试图从我的sql脚本调用Oracle过程。

该文件名为V1.0.0__test.sql,内容为:

execute pkg_test.pr_do_task('TEST_VALUE');

格式是否正确?我运行

时只收到一般错误
mvn -P DEV clean compile flyway:migrate

这是:

[ERROR] Failed to execute goal com.googlecode.flyway:flyway-maven-plugin:2.0.3:migrate (default-cli) on project bambi-ex
man-sql: Flyway Error: com.googlecode.flyway.core.api.FlywayException: Migration to version 4.0.0 failed! Please restore
 backups and roll back database and code! -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.googlecode.flyway:flyway-maven-plugin
:2.0.3:migrate (default-cli) on project bambi-exman-sql: Flyway Error: com.googlecode.flyway.core.api.FlywayException: M
igration to version 4.0.0 failed! Please restore backups and roll back database and code!
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Flyway Error: com.googlecode.flyway.core.api.FlywayException:
 Migration to version 4.0.0 failed! Please restore backups and roll back database and code!
        at com.googlecode.flyway.maven.AbstractFlywayMojo.execute(AbstractFlywayMojo.java:200)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: com.googlecode.flyway.core.api.FlywayException: Migration to version 4.0.0 failed! Please restore backups and
 roll back database and code!
        at com.googlecode.flyway.core.migration.DbMigrator.migrate(DbMigrator.java:186)
        at com.googlecode.flyway.core.Flyway$1.execute(Flyway.java:856)
        at com.googlecode.flyway.core.Flyway$1.execute(Flyway.java:820)
        at com.googlecode.flyway.core.Flyway.execute(Flyway.java:1259)
        at com.googlecode.flyway.core.Flyway.migrate(Flyway.java:820)
        at com.googlecode.flyway.maven.MigrateMojo.doExecuteWithMigrationConfig(MigrateMojo.java:159)
        at com.googlecode.flyway.maven.AbstractMigrationLoadingMojo.doExecute(AbstractMigrationLoadingMojo.java:162)
        at com.googlecode.flyway.maven.AbstractFlywayMojo.execute(AbstractFlywayMojo.java:191)
        ... 21 more

我似乎无法获得完整的堆栈跟踪。

由于

2 个答案:

答案 0 :(得分:2)

Try this,

begin
 pkg_test.pr_do_task('TEST_VALUE');
end;
/

答案 1 :(得分:0)

在这种情况下,错误报告肯定可以而且应该得到改进。请在问题跟踪器中提交增强请求。