I’m using --liquibase formatted sql
for installing of PL/SQL objects in an Oracle database with the official Liquibase image 4.9.0 from Liquibase Docker Image.
With Liquibase 4.8.0 the installation of a PL/SQL function in an Oracle 21 XE database with the following source code is working without any problems:
--liquibase formatted sql
--changeset data_public:create_fnc_get_elapsed_time.sql dbms:oracle endDelimiter:/ failOnError:false runAlways:true runOnChange:true stripComments:false splitStatements:true
CREATE OR REPLACE FUNCTION fnc_get_elapsed_time
(i_start_time IN NUMBER
,i_end_time IN NUMBER
)
RETURN NUMBER
PARALLEL_ENABLE
IS
BEGIN
RETURN ((i_end_time - i_start_time) / 100);
EXCEPTION
WHEN OTHERS
THEN
BEGIN
RAISE;
END;
END fnc_get_elapsed_time;
/
After upgrade of the Liquibase image to version 4.9.0, the available source code of the function in the database ends before “/” in the return statement and the function is invalid because of missing code.
The used settings when Liquibase is executed are the same with both versions.
Also the database environment is both times the same an Oracle database 21 XE.
And as JDBC driver Oracle Instant Client 21.5.0.0.0 64 bit on Linux is used.
For me this problem is repeatable.
When the installation is executed with Liquibase 4.8.0, the source code of the function in the database is completely installed and the function is valid.
When the installation is executed with Liquibase 4.9.0, the source code of the function in the database is incomplete and the function is invalid.
Has there been a change belonging to endDelimiter handling from 4.8.0 to 4.9.0?
Following data is logged, when Liquibase 4.9.0 is executed with logLevel: debug:
Running Changeset: 012-DATA_PUBLIC/008-Functions/create_fnc_get_elapsed_time.sql::create_fnc_get_elapsed_time.sql::data_public
[2022-03-27 14:46:09] FINE [liquibase.changelog] Running Changeset: 012-DATA_PUBLIC/008-Functions/create_fnc_get_elapsed_time.sql::create_fnc_get_elapsed_time.sql::data_public
[2022-03-27 14:46:09] FINE [liquibase.executor] Changeset 012-DATA_PUBLIC/008-Functions/create_fnc_get_elapsed_time.sql::create_fnc_get_elapsed_time.sql::data_public
[2022-03-27 14:46:09] FINE [liquibase.changelog] Reading ChangeSet: 012-DATA_PUBLIC/008-Functions/create_fnc_get_elapsed_time.sql::create_fnc_get_elapsed_time.sql::data_public
[2022-03-27 14:46:09] FINE [liquibase.database] Executing Statement: CREATE OR REPLACE FUNCTION fnc_get_elapsed_time
/**
* Calculates the current elapsed time in seconds since the given start time.
*
*
*/
(i_start_time IN NUMBER
,i_end_time IN NUMBER
)
RETURN NUMBER
PARALLEL_ENABLE
IS
BEGIN
RETURN ((i_end_time - i_start_time)
[2022-03-27 14:46:09] FINE [liquibase.executor] Executing with the 'jdbc' executor
[2022-03-27 14:46:09] FINE [liquibase.executor] CREATE OR REPLACE FUNCTION fnc_get_elapsed_time
/**
* Calculates the current elapsed time in seconds since the given start time.
*
*
*/
(i_start_time IN NUMBER
,i_end_time IN NUMBER
)
RETURN NUMBER
PARALLEL_ENABLE
IS
BEGIN
RETURN ((i_end_time - i_start_time)
[2022-03-27 14:46:09] FINE [liquibase.executor] 0 row(s) affected
[2022-03-27 14:46:09] FINE [liquibase.database] Executing Statement: 100);
EXCEPTION
WHEN OTHERS
THEN
BEGIN
RAISE;
END;
END fnc_get_elapsed_time;
[2022-03-27 14:46:09] FINE [liquibase.executor] Executing with the 'jdbc' executor
[2022-03-27 14:46:09] FINE [liquibase.executor] 100);
EXCEPTION
WHEN OTHERS
THEN
BEGIN
RAISE;
END;
END fnc_get_elapsed_time;
[2022-03-27 14:46:09] FINE [liquibase.executor] Release Database Lock
[2022-03-27 14:46:09] FINE [liquibase.executor] Executing with the 'jdbc' executor
[2022-03-27 14:46:09] INFO [liquibase.lockservice] Successfully released change log lock
[2022-03-27 14:46:09] SEVERE [liquibase.integration] ORA-00900: invalid SQL statement
liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: Unexpected error running Liquibase: Migration failed for change set 012-DATA_PUBLIC/008-Functions/create_fnc_get_elapsed_time.sql::create_fnc_get_elapsed_time.sql::data_public:
Reason: liquibase.exception.DatabaseException: ORA-00900: invalid SQL statement
[Failed SQL: (900) 100);
EXCEPTION
WHEN OTHERS
THEN
BEGIN
RAISE;
END;
END fnc_get_elapsed_time;]
at liquibase.command.CommandScope.execute(CommandScope.java:163)
at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:51)
at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:21)
at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine.execute(CommandLine.java:2078)
at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$1(LiquibaseCommandLine.java:325)
at liquibase.Scope.child(Scope.java:189)
at liquibase.Scope.child(Scope.java:165)
at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:291)
at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:80)