我正在尝试添加简单的oracle函数,在SQLDeveloper中它编译并运行,但是当我将它添加到liquibase迁移时,迁移失败。
CREATE OR REPLACE FUNCTION test_func
(test_param IN VARCHAR2
) RETURN INT
IS
test_var INT;
BEGIN
RETURN 0;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END test_func;
/
迁移时遇到的错误
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:2.0.3:update (liquibase) on project tools-liquibase: Error setting up or running Liquibase: Migration failed for change set .....
[ERROR] Reason: liquibase.exception.DatabaseException: Error executing SQL BEGIN
[ERROR] RETURN 0: ORA-06550: line 2, column 10:
[ERROR] PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
PS:发现的解决方案,应该为liqibase变更集中的sqlFile或sql添加endDelimiter =“/”,如
<changeSet id="..." author="andymur" logicalFilePath="">
<comment></comment>
<sqlFile endDelimiter="/"
path="my.sql"/>
</changeSet>