我正在使用flyway commandline 2.0.3
来迁移db2 LUW数据库。它适用于持有create table语句等的各种脚本。但是我无法执行create procedure语句。似乎处理错误的开始结束块。
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;
...
以下是migrate-command的输出:
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
和flyway 1.7
类似的问题。
有没有办法处理db2-database的问题?
答案 0 :(得分:1)
目前尚不支持此功能。请在Issue Tracker中提交增强请求。确保包含一个包含CREATE PROCEDURE语句的脚本,这样我就可以确保您的案例被测试所覆盖。
答案 1 :(得分:0)
我们已经能够通过使用在分号后面的语句中立即添加注释的技巧来解决DB2 flyway脚本中的大多数BEGIN / END块问题。
BEGIN
Statment1;--
Statment2;--
Statment3;--
END;
当使用DB2 CLP和JDBC应用脚本时,这是有效的。