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 export: 25.3.2 newlines in views lost when trailing whitespace

Casper Linschooten12 hours ago — edited 12 hours ago

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

Comments
Post Details
Added 12 hours ago
0 comments
20 views