Skip to Main Content

SQLcl: MCP Server & SQL Prompt

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQLcl Project: Please Split DDL Statements in a File Into Logical Changesets

Alexander KluevNov 20 2025

Hello team,

Is it possible to split a change set containing multiple DDL statements into several logical change set?

Here's a real-life example: During the last sprint developers made a lot of changes in CLA_AIRCRAFT table, and after I ran project stage my file in dist/releases/next/changes/dev-02/cla_apex/tables/cla_aircraft.sql looks like this:

-- liquibase formatted sql 
-- sqlcl_snapshot src/database/cla_apex/tables/cla_aircraft.sql:08bee489420289da19c387e5b924e0e21acc0faa:f6b3abb88fff315ad9e845989ec24ed6b54d31a3:alter 
-- changeset CLA_APEX:1761764378736 stripComments:false logicalFilePath:dev-02\cla_apex\tables\cla_aircraft.sql 

alter table cla_apex.cla_aircraft 
drop (fl3xx_live); 

alter table cla_apex.cla_aircraft add ( 
adult_critical_care number(1, 0), 
aviapages_aircraft_id number, 
aviapages_aircraft_type_id number, 
year_of_production number 
); 

alter table cla_apex.cla_aircraft 
add constraint make_model_serial_uk2 unique (aviapages_aircraft_type_id, serial_number) 
using index enable; 

alter table cla_apex.cla_aircraft 
add constraint registration_uk1 unique (registration) 
using index enable;

I.e. the file contains only one change set `changeset CLA_APEX:1761764378736`.

Question: Would it be possible to generate a file so it looks like below, i.e. contains 4 changesets (One for each DDL) from 1761764378736.1 to 1761764378736.4:

-- liquibase formatted sql 
-- sqlcl_snapshot src/database/cla_apex/tables/cla_aircraft.sql:08bee489420289da19c387e5b924e0e21acc0faa:f6b3abb88fff315ad9e845989ec24ed6b54d31a3:alter 

-- changeset CLA_APEX:1761764378736.1 stripComments:false logicalFilePath:dev-02\cla_apex\tables\cla_aircraft.sql 
alter table cla_apex.cla_aircraft 
drop (fl3xx_live); 

-- changeset CLA_APEX:1761764378736.2 stripComments:false logicalFilePath:dev-02\cla_apex\tables\cla_aircraft.sql 
alter table cla_apex.cla_aircraft add ( 
adult_critical_care number(1, 0), 
aviapages_aircraft_id number, 
aviapages_aircraft_type_id number, 
year_of_production number 
); 

-- changeset CLA_APEX:1761764378736.3 stripComments:false logicalFilePath:dev-02\cla_apex\tables\cla_aircraft.sql 
alter table cla_apex.cla_aircraft 
add constraint make_model_serial_uk2 unique (aviapages_aircraft_type_id, serial_number) 
using index enable; 

-- changeset CLA_APEX:1761764378736.4 stripComments:false logicalFilePath:dev-02\cla_apex\tables\cla_aircraft.sql 
alter table cla_apex.cla_aircraft 
add constraint registration_uk1 unique (registration) 
using index enable; 

Current design prevents Liquibase from properly tracking execution progress and makes failed deployments non-restartable.

I think benefits are obvious, in my proposed design, if statements 1 and 2 run, but statement 3

alter table cla_apex.cla_aircraft 
add constraint make_model_serial_uk2 unique (aviapages_aircraft_type_id, serial_number) 
using index enable;

fails, I only need to fix the data issue with the constraint and rerun the installation,

In the current scenerio, I would need to manually rerun both

alter table cla_apex.cla_aircraft 
add constraint make_model_serial_uk2 unique (aviapages_aircraft_type_id, serial_number) 
using index enable; 

alter table cla_apex.cla_aircraft 
add constraint registration_uk1 unique (registration) 
using index enable;

and after that run liquibase mark-next-changeset-ran to proceed with the installation. This is more time consuming, error prone, and not very intuitive.

I hope that would be a fix that is easy to make.

Thanks,

Alex

This post has been answered by danmcghan-Oracle on Nov 21 2025
Jump to Answer
Comments
Post Details
Added on Nov 20 2025
1 comment
58 views