Skip to Main Content

SQLcl

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

Liquibase adds a ALTER TRIGGER and then reports an error about it

Soeren DFeb 28 2024 — edited Feb 28 2024

Hi

When I use a

lb generate-schema

to generate XML for triggers it adds an ALTER TRIGGER that is not part of the source

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog 
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:n0="http://www.oracle.com/xml/ns/dbchangelog-ext" 
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog 
    http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet id="1f856f938cc605a6337cb2824f9fcb41f026cb62" author="(XXSDU)-Generated" failOnError="false"   runOnChange="true" runAlways="false"  >
        <n0:createOracleTrigger objectName="RC_CONTRACT_BIU" objectType="TRIGGER" ownerName="XXSDU"  replaceIfExists="true" >
            <n0:source><![CDATA[
  CREATE OR REPLACE EDITIONABLE TRIGGER "XXSDU"."RC_CONTRACT_BIU" 
    before insert or update 
    on rc_contract
    for each row
begin
    if inserting then
        :new.created := sysdate;
        :new.created_by := coalesce(sys_context('APEX$SESSION','APP_USER'),user);
    end if;
    :new.updated := sysdate;
    :new.updated_by := coalesce(sys_context('APEX$SESSION','APP_USER'),user);
end rc_contract_biu;

ALTER TRIGGER "XXSDU"."RC_CONTRACT_BIU" ENABLE]]></n0:source>
        </n0:createOracleTrigger>
    </changeSet>
</databaseChangeLog>

When I then the use

lb update

to update another database it complains about the very same ALTER TRIGGER statement:

Running Changeset: trigger/rc_contract_biu_trigger.xml::1f856f938cc605a6337cb2824f9fcb41f026cb62::(XXSDU)-Generated
Trigger RC_CONTRACT_BIU compiled
LINE/COL  ERROR
--------- -------------------------------------------------------------
10/1      PLS-00103: Encountered the symbol "ALTER"
Errors: check compiler log
Rolling back changeset.

Rollback completed successfully.

How do I fix this?

Thanks in advance

Kind regards
Soeren D.

Comments
Post Details
Added on Feb 28 2024
3 comments
128 views