1

我想在 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 服务器版本相对应的手册,以获取在“创建过程 proc()”附近使用的正确语法

在第 3 行开始声明 v_max' [Failed SQL: (1064) drop procedure if exists proc;

创建过程 proc()

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

4

0 回答 0