How to Continue with PLSQL SQL Formatter Settings After Project Discontinuation

Jan 18, 2024 | Programming

In a recent turn of events, @PhilippSalvisberg has announced that he will continue the PLSQL SQL Formatter project independently, after the original repository was archived on August 30, 2024. This guide will walk you through utilizing the PLSQL SQL Formatter Settings with a special focus on installation, patching SQL Developer, and troubleshooting.

Understanding the PLSQL SQL Formatter

This repository provides formatter settings to maintain coding standards according to the Trivadis PLSQL & SQL Coding Guidelines. These settings cater mainly to:

Please keep in mind that these settings are compatible only with specific versions, and not suitable for all, especially the embedded version of SQLcl 23.3.1.0. It’s important to ensure that you have the right versions installed before proceeding!

How to Patch SQL Developer

Over time, SQL Developer has begun to fade out as SQLcl rises to prominence. However, if you wish to integrate the current formatting rules into SQL Developer, follow these steps:

  1. Quit SQL Developer to avoid issues during patching.
  2. Find and rename SQL Developer’s dbtools-common.jar located in Applications/SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/lib to dbtools-common.original.jar.
  3. Copy the dbtools-common.jar from your SQLcl installation located at /usr/local/bin/sqlcl/lib into the SQL Developer’s lib folder.
  4. Run specific commands in the terminal to modify the copied dbtools-common.jar:
  5. bash
    jar -xvf dbtools-common.original.jar oracle/dbtools/parser/ParseNode.class
    jar -u0vMf dbtools-common.jar oracle/dbtools
    rm -rf oracle
    
  6. Clear SQL Developer’s cache based on your OS by deleting the corresponding system cache folder.
  7. Restart SQL Developer and verify that the formatter and code outline functionality works correctly.

Deviating Settings

It’s important to note that while these settings are robust, they do not strictly comply with rule 5 where line breaks are placed after a comma, and not before as outlined in the guidelines. However, this can be adjusted easily in preferences.

Change Line Breaks On Comma

Installation Process

Common Installation Steps

  1. Clone the repository or download the ZIP file and extract it.

SQLcl Installation

Refer to sqlclREADME.md for detailed information.

Standalone Formatter Installation

Check the standaloneREADME.md for instructions.

SQL Developer Setup

  1. Open SQL Developer, then navigate to Preferences.
  2. Select Code Editor -> Format -> Advanced Format, and import the appropriate XML settings files.
Advanced Format Custom Format

Troubleshooting Tips

If you encounter problems, here are some troubleshooting ideas:

  • Ensure that you are using compatible versions of SQL Developer and SQLcl.
  • Double-check the cache has been properly cleared.
  • Restart SQL Developer after making changes.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

A Little Extra

The Arbori program offers a lightweight formatter for various SQL statements, making it adaptable for different coding styles. Keep in mind, if you need a strict compliance tool, the default Arbori formatter by SQL Developer is essential.

To keep the formatter from interfering with specific code sections, you can easily toggle formatting with comments like @formatter:off and @formatter:on.

Conclusion

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Follow this guide closely to ensure a smooth transition to the newly maintained PLSQL SQL Formatter Settings!

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox