Applies to:
- Liquibase Pro
- Liquibase Open Source (Community)
Conditions:
- Oracle database
- Deploying a changelog with both a package spec and package body in the same file.
Issue Summary:
If Oracle Package spec and Package Body are included in the same changelog, Liquibase deploys the spec but skips the Body. This requires separate Package spec and Package Body using a slash character. When using an XML changeset to call the SQL script, additional tags can be specified.
Error Message:
No error is presented, but the package body isn't deployed.
Root Cause:
The wrong delimiter is specified, so Liquibase doesn't parse the body.
Resolution:
When you have an Oracle Package and Package Body in the same SQL script (Liquibase Formatted SQL), you will need to add a "/" after the package and package body code, as follows:
CREATE OR REPLACE PACKAGE <packageName>
/* package code here */
END <packageName>
/
CREATE OR REPLACE PACKAGE BODY <packageName>
/* package body code here */
END <packageName>
/
When using an XML changeset for calling this script, it should look like the example below. Make sure to use stripComments="true" if you use the '/* */' style of comments. Also, be sure to use splitStatements="true".
<changeSet author="adeel" id="oracle_pks" runAlways="true" runOnChange="true">
<sqlFile endDelimiter="/"
path="oracle_pks.sql"
relativeToChangelogFile="true"
splitStatements="true"
stripComments="true"
/>
</changeSet>
Related Article(s):
N/A
Comments
0 comments
Article is closed for comments.