Hey Team,
Found a bug in the exporting process of SQLcl Project, spotted it when upgrading from 24.4.1 to 25.3.2. It seems that in views:
- Lines of code with trailing whitespace are losing their newline characters during export.
- The first line of the view is always collapsed into the first line of the create statement, similar to Alexander's finding (https://forums.oracle.com/ords/apexds/post/sqlcl-project-project-export-collapses-leading-comment-line-1668).
Settings / notes:
- export formatting disabled
- Tested in 24.4.1 (no problem), 25.3.0 (problem) and 25.3.2 (problem)
Example (note the extra space on lines 3, 7 and 8):
create or replace view v_customerorders as
select c.code,
o.id,
o.orderquantity,
o.orderstatus
from orders o
join customers c on c.id = o.customerid
where 1=1
and c.code = 'SOMEONE';
When exporting this becomes (project export -o v_customerorders):
CREATE OR REPLACE FORCE EDITIONABLE VIEW "V_CUSTOMERORDERS" ("CODE", "ID", "ORDERQUANTITY", "ORDERSTATUS") AS select c.code,
o.id, o.orderquantity,
o.orderstatus
from orders o
join customers c on c.id = o.customerid where 1=1 and c.code = 'SOMEONE';
-- sqlcl_snapshot {"hash":"632e8846203e7bc227a80463f06897f630d0e98e","type":"VIEW","name":"V_CUSTOMERORDERS","schemaName":"","sxml":""}
In 24.4.1 the output used to be:
CREATE OR REPLACE FORCE EDITIONABLE VIEW "V_CUSTOMERORDERS" ("CODE", "ID", "ORDERQUANTITY", "ORDERSTATUS") AS
select c.code,
o.id,
o.orderquantity,
o.orderstatus
from orders o
join customers c on c.id = o.customerid
where 1=1
and c.code = 'SOMEONE';
-- sqlcl_snapshot {"hash":"4daa97c19c20aff049c5622933a3d8148c9f47ec","type":"VIEW","name":"V_CUSTOMERORDERS","schemaName":"","sxml":""}
I'm working on a large DB project with many views, so this is fairly painful and makes drift detection trickier