For 17.4, the formatter will attempt to format invalid SQL for you.
If the parser runs into a problem recognizing your code, it will format it as much as it can. But that’s not all.
It will ALSO go to the end of your statement, and traverse the SQL in the other direction and continue formatting as far as it can.
Let’s look at an example:
Before
But hey, let’s format it anyway.
Cause hey, we’re trying to fix the code, but it’s so hard to read. We could really use the formatter’s help.
Almost
Adds the missing pipe |, formats again.
After
When does 17.4 come out?
Soon’ish. But the name should give you a pretty good hint.
11 Comments
I’m glad to hear that the formatter will someday be able to better handle SQL that contains errors. Perhaps that would have helped me to more quickly identify an issue that I encountered recently. The formatter in SQL Developer v17.2 does not seem to recognize ANSI join syntax.
For example, I would like this unformatted SQL…
with escalation_order AS
(
select unit_id
from order__table
where name = ‘exception_ind’
and upper(value) = ‘YES’
)
select eo.unit_id
from escalation_order eo
join on item_table it on eo.unit_id = it.action_id AND it.type = ‘XX’;
…to look something like this after formatting.
WITH escalation_order AS
(
SELECT
unit_id
FROM
order_table
WHERE
name = ‘EXCEPTION_IND’
AND UPPER( value ) = ‘YES’
) SELECT
eo.unit_id
FROM
escalation_order eo
JOIN ON item_table it
ON eo.unit_id = it.action_id
AND it.type = ‘XX’;
Unfortunately, the formatter wouldn’t make any changes to the query. I tried selecting parts of the query and applying the formatter and it worked until I reached the “JOIN ON” part. It seems that the formatter does not like ANSI join syntax. This is disappointing since Oracle obviously supports it and we use it frequently.
Additionally, I would like standard Oracle function names (ex. UPPER) to be considered as keywords for the purpose of capitalization.
Jeff, for clarification, the error above occurred in a report that is PL/SQL-based. SQL-only reports are working.
Regards, JT
Jeff, for clarification, plain SQL reports do now work. The failing one is a PL/SQL report.
Great. So that would be a separate bug. I’ll re-open the existing with the ‘new’ test case. Thanks for the heads-up.
Jeff,
It’s here!
What other enhancements can we find?
BTW Happy New Year and thanks for the support
It’s mostly just bug fixes. The insight support for plsql packages is better, the formatter got more tweaks.
A few forum requests were implemented.
Jeff, hit by “Bug 27115078 java.lang.IllegalArgumentException: null connection not allowed” just as experimenting with command line reports…
Can’t wait for 17.4!
Regards, JT
Won’t be long now…
🙂 Thanks for quick response.
Not quite there yet…
C:\sqldeveloper17.4\sqldeveloper\bin>sdcli64 reports generate -report “Redo heat map” -db DBNAME -file c:\temp\heatmap
Command failed:
java.lang.IllegalArgumentException: null connection not allowed
at oracle.dbtools.db.DefaultConnectionIdentifier.(DefaultConnectionIdentifier.java:29)
at oracle.dbtools.db.DefaultConnectionIdentifier.createIdentifier(DefaultConnectionIdentifier.java:21)
at oracle.dbtools.raptor.metadata.AbstractDisplayModel.getQuery(AbstractDisplayModel.java:393)
at oracle.dbtools.raptor.metadata.AbstractDisplayModel.getQuery(AbstractDisplayModel.java:377)
at oracle.dbtools.raptor.controls.display.html.PLSQLHtmlGenerator.generateHtml(PLSQLHtmlGenerator.java:38)
at oracle.dbtools.raptor.controls.display.DisplayHtml.generateStyleSpecificHtml(DisplayHtml.java:391)
at oracle.dbtools.raptor.controls.display.DisplayHtml.generateModelHtml(DisplayHtml.java:325)
at oracle.dbtools.raptor.controls.display.DisplayHtml.generateHtml(DisplayHtml.java:261)
at oracle.dbtools.raptor.controls.display.DisplayHtml.generate(DisplayHtml.java:202)
at oracle.dbtools.raptor.report.headless.ReportsProcessor$GenerateReportTask.doWork(ReportsProcessor.java:101)
at oracle.dbtools.raptor.report.headless.ReportsProcessor$GenerateReportTask.doWork(ReportsProcessor.java:39)
at oracle.dbtools.raptor.backgroundTask.RaptorTask.call(RaptorTask.java:199)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager$RaptorFutureTask.run(RaptorTaskManager.java:702)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
hmmm, the developer marked that bug as fixed…
27115078 – SDCLI REPORTS GENERATION FILES WITH NULL CONNECTION NOT ALLOWED