我正在尝试添加简单的 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;
/
Run Code Online (Sandbox Code Playgroud)
我在迁移时遇到错误
[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:
Run Code Online (Sandbox Code Playgroud)
PS:找到解决方案,应该在 liquibase 变更集中为 sqlFile 或 sql 添加 endDelimiter="/"
<changeSet id="..." author="andymur" logicalFilePath="">
<comment></comment>
<sqlFile endDelimiter="/"
path="my.sql"/>
</changeSet>
Run Code Online (Sandbox Code Playgroud)