1

我正在使用flyway commandline 2.0.3迁移 db2 LUW 数据库。它适用于保存创建表语句等的各种脚本。但我无法执行创建过程语句。begin-end 块似乎处理错误。

SET CURRENT SCHEMA = DB2INST1;

SET CURRENT PATH = SYSIBM,SYSFUN,SYSPROC,SYSIBMADM,DB2INST1;

CREATE OR REPLACE PROCEDURE ${schema_name_node}.SP_E_H_A_D_V (
    IN "@M" VARCHAR(15000),
    IN "@S" TIMESTAMP,
    IN "@E" TIMESTAMP,
    IN "@T" DECIMAL(4, 2) )
  SPECIFIC "SP_E_H_A_D_V"
  DYNAMIC RESULT SETS 1
  LANGUAGE SQL
  NOT DETERMINISTIC
  NO EXTERNAL ACTION
  READS SQL DATA
  CALLED ON NULL INPUT
  INHERIT SPECIAL REGISTERS
  OLD SAVEPOINT LEVEL
BEGIN 
DECLARE V_MINUTES INTEGER DEFAULT 0;
...

这是迁移命令的输出:

 D:\flyway-commandline-2.0.3-dist\flyway-commandline-2.0.3>flyway.cmd migrate
Flyway (Command-line Tool) v.2.0.3

Current schema version: 1.13.1.201211151200.04.000
Migrating to version 1.13.1.201212101200.04.000
ERROR: com.googlecode.flyway.core.api.FlywayException: Error executing statement
 at line 5: CREATE OR REPLACE PROCEDURE JUDITH_NODE.SP_E_H_A_D_V
 (
    IN "@M"     VARCHAR(15000),
    IN "@S"     TIMESTAMP,
    IN "@E"     TIMESTAMP,
    IN "@T"     DECIMAL(4, 2) )
  SPECIFIC "SP_E_H_A_D_V"
  DYNAMIC RESULT SETS 1
  LANGUAGE SQL
  NOT DETERMINISTIC
  NO EXTERNAL ACTION
  READS SQL DATA
  CALLED ON NULL INPUT
  INHERIT SPECIAL REGISTERS
  OLD SAVEPOINT LEVEL
BEGIN
DECLARE V_MINUTES INTEGER DEFAULT 0
ERROR: Caused by com.ibm.db2.jcc.am.ro: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42
601, SQLERRMC=END-OF-STATEMENT;ES INTEGER DEFAULT 0;<psm_semicolon>, DRIVER=3.58
.82
ERROR: FlywayException: Migration to version 1.13.1.201212101200.04.000 failed!
Changes successfully rolled back.
ERROR: Occured in com.googlecode.flyway.core.migration.DbMigrator.applyMigration
() at line 266

hsql我发现了一个与and类似的问题的问题flyway 1.7

有没有办法处理 db2-database 的问题?

4

2 回答 2

1

尚不支持此功能。请在问题跟踪器中提交增强请求。确保包含一个包含 CREATE PROCEDURE 语句的脚本,以便我可以确保您的案例被测试覆盖。

于 2013-01-15T15:15:42.753 回答
0

通过使用在块内的语句的分号后立即添加注释的技巧,我们已经能够解决 DB2 flyway 脚本的大多数 BEGIN/END 块问题。

BEGIN
  Statment1;--
  Statment2;--
  Statment3;--
END;

这在使用 DB2 CLP 和 JDBC 应用脚本时有效。

于 2013-09-04T15:00:22.363 回答