如何在liquibase 4.0.0中使用sql过程或while / for循环?

问题描述

我想在sql文件中使用for / while循环。 因此定义了proc sql。顺便说一句错误

<changeSet id="Trade_proc" author="alex">
        <sqlFile endDelimiter="//" path="Trade.h2.proc.sql" stripComments="true" />
    </changeSet>

----------------------- sql文件---------

drop procedure if exists proc;

create procedure proc()

begin
declare v_max int unsigned default 3;
declare v_counter int unsigned default 0;
while v_counter < v_max do  
...

end while;
end //

-----------------错误------------ 运行Liquibase发生意外错误:更改集changelog.xml :: Trade_history_20200728_proc :: alex的迁移失败: 原因:liquibase.exception.DatabaseException:您的sql语法有错误。查看与您的MysqL服务器版本相对应的手册,以获取在'create procedure proc()

附近使用的正确语法

开始 在第3行声明v_max [失败的sql:(1064)删除过程,如果存在proc;

创建过程proc()

========= 什么原因? 或者请帮助我如何在liquibase MysqL中使用while / for循环。 谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)