{"id":11201,"date":"2021-07-18T17:09:59","date_gmt":"2021-07-18T15:09:59","guid":{"rendered":"https:\/\/www.salvis.com\/blog\/?p=11201"},"modified":"2023-11-12T13:59:14","modified_gmt":"2023-11-12T12:59:14","slug":"lightweight-formatter-for-pl-sql-sql","status":"publish","type":"post","link":"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/","title":{"rendered":"Lightweight Formatter for PL\/SQL &#038; SQL"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">TL;DR<\/h2>\n\n\n\n<p>Bye bye, heavyweight formatter. Long live the lightweight formatter. Are you using Oracle&#8217;s SQL Developer or SQLcl? Then install <a href=\"https:\/\/github.com\/Trivadis\/plsql-formatter-settings#installation\">these settings<\/a> and press Ctrl-F7 to produce code that conforms to the <a href=\"https:\/\/trivadis.github.io\/plsql-and-sql-coding-guidelines\/v4.0\/3-coding-style\/coding-style\/\">Trivadis PL\/SQL &amp; SQL Coding Style<\/a>. A compromise between conformity and individuality.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Heavyweight Formatter<\/h2>\n\n\n\n<p>A typical PL\/SQL &amp; SQL formatter replaces whitespace between lexical tokens by default with a single space. A whitespace consists of a series of spaces, tabs and line breaks. As a result, the original whitespace between the tokens is lost. The grammars for SQL*Plus, PL\/SQL and SQL are huge. As a consequence, a single space is not the desired result in many cases. Therefore, a formatter comes with a large set of rules and options to override the default (single space between tokens).<\/p>\n\n\n\n<p>A key feature of a heavyweight formatter is that it produces the same result regardless of how the original code was formatted. There is no room for individuality unless it is part of a rule and its configuration. This makes a complete formatter a heavyweight.<\/p>\n\n\n\n<p>Here is a <code>create view<\/code> example. Once formatted with spaces between the tokens and once with line breaks between the tokens.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"create view v as select empno , ename from emp ;\n\ncreate \nview \nv \nas \nselect \nempno\n, \nename \nfrom \nemp\n;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">create<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">view<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">v<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">as<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> empno , ename <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> emp ;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">create<\/span><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">view <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">v <\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">as<\/span><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">empno<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">, <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">ename <\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">emp<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Here are the formatter results for some popular integrated development environments for PL\/SQL &amp; SQL. I configured the tools with <a href=\"https:\/\/github.com\/Trivadis\/plsql-formatter-settings\/tree\/196283ea9284993829b96dd49b851ac309332a66\/settings\">these settings<\/a> based on the <a href=\"https:\/\/trivadis.github.io\/plsql-and-sql-coding-guidelines\/v4.0\/3-coding-style\/coding-style\/\">Trivadis PL\/SQL &amp; SQL Coding Style<\/a>. For SQL Developer I loaded only the .xml file and used the default custom formatting rules (Arbori program).<\/p>\n\n\n<div class=\"jq-tabs tabs_wrapper tabs_\"><ul><li><a href=\"#tab-69d049a5c0741-1\">SQL Developer 21.2.0<\/a><\/li><li><a href=\"#tab-69d049a5c0741-2\">PL\/SQL Developer 14.0.5<\/a><\/li><li><a href=\"#tab-69d049a5c0741-3\">TOAD 14.1<\/a><\/li><\/ul><div id=\"tab-69d049a5c0741-1\" ><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"create view v as\n   select empno,\n          ename\n     from emp;\n \ncreate view v as\n   select empno,\n          ename\n     from emp;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">create<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">view<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">v<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">as<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">   <\/span><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> empno,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">          ename<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">     <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> emp;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">create<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">view<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">v<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">as<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">   <\/span><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> empno,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">          ename<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">     <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> emp;<\/span><\/span><\/code><\/pre><\/div>\n\n\n<p><\/div><div id=\"tab-69d049a5c0741-2\" ><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"select empno, ename\n  from emp;\n \nselect empno, ename\n  from emp;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> empno, ename<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> emp;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> empno, ename<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> emp;<\/span><\/span><\/code><\/pre><\/div>\n\n\n<p><\/div><div id=\"tab-69d049a5c0741-3\" ><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"create view v\nas\n   select empno, ename from emp;\n \ncreate view v\nas\n   select empno, ename from emp;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">create<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">view<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">v<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">as<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">   <\/span><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> empno, ename <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> emp;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">create<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">view<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">v<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">as<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">   <\/span><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> empno, ename <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> emp;<\/span><\/span><\/code><\/pre><\/div>\n\n\n<p><\/div><\/div>\n\n\n\n<p>All tools produced the same result for both variants of the statement. However, the result differs between the tools, although the configuration is based on the same code style. Why is that so? Let&#8217;s look at the code style to answer this question.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Trivadis Formatting Rules<\/h2>\n\n\n\n<p>The Trivadis PL\/SQL &amp; SQL Coding Guidelines contain the following rules for code formatting in the <a href=\"https:\/\/trivadis.github.io\/plsql-and-sql-coding-guidelines\/v4.0\/3-coding-style\/coding-style\/#formatting\">Code Style<\/a> chapter:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Keywords and names are written in lowercase<\/li>\n\n\n\n<li>3 space indention.<\/li>\n\n\n\n<li>One command per line.<\/li>\n\n\n\n<li>Keywords <code>loop<\/code>, <code>else<\/code>, <code>elsif<\/code>, <code>end if<\/code>, <code>when<\/code> on a new line.<\/li>\n\n\n\n<li>Commas in front of separated elements.<\/li>\n\n\n\n<li>Call parameters aligned, operators aligned, values aligned.<\/li>\n\n\n\n<li>SQL keywords are right aligned within a SQL command.<\/li>\n\n\n\n<li>Within a program unit only line comments &#8212; are used.<\/li>\n\n\n\n<li>Brackets are used when needed or when helpful to clarify a construct.<\/li>\n<\/ol>\n\n\n\n<p>When you go through the list, you find out that only rule 5 has been violated. However, this violation was intentional. I use trailing commas whenever I&#8217;m allowed to and therefore I changed the default. A privilege of the maintainer. You like leading commas? No problem. You can configure whatever you want in the preferences of SQL Developer.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/change_line_breaks_on_comma.png\"><img loading=\"lazy\" decoding=\"async\" width=\"466\" height=\"104\" src=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/change_line_breaks_on_comma.png\" alt=\"\" class=\"wp-image-11253\" srcset=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/change_line_breaks_on_comma.png 466w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/change_line_breaks_on_comma-300x67.png 300w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/change_line_breaks_on_comma-260x58.png 260w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/change_line_breaks_on_comma-50x11.png 50w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/change_line_breaks_on_comma-150x33.png 150w\" sizes=\"auto, (max-width:767px) 466px, 466px\" \/><\/a><\/figure>\n\n\n\n<p>The point is, all rules are vaguely worded and leave a lot of room for interpretation. Furthermore, rules 1, 8 and 9 are about code style, but not about formatting of code. Code formatting should be exclusively about whitespace between tokens. Extending the scope can be dangerous and break the code, e.g. when using JSON dot notation, which uses case-sensitive identifiers.<\/p>\n\n\n\n<p>These rules are a good starting point for a developer who knows PL\/SQL &amp; SQL. However, they leave a lot of freedom when configuring a formatter. And they are for sure not suitable as a specification for a formatter.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Lightweight Formatter<\/h2>\n\n\n\n<p>A lightweight formatter preserves whitespace between lexical tokens by default. Based on a set of rules and options, the whitespace between tokens is then fixed. This allows the lightweight formatter to produce a reasonable result with a small set of rules.<\/p>\n\n\n\n<p>Let&#8217;s compare a minimalistic heavyweight and lightweight formatter. Both formatter do not implement any rules. The formatter just returns the default whitespace between tokens.<\/p>\n\n\n\n<p>Here&#8217;s the formatter input based on an example from the <a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/21\/sqlrf\/CREATE-TABLESPACE.html#GUID-51F07BF5-EFAF-4910-9040-C473B86A8BF9\">SQL Language Reference<\/a>:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Unformatted SQL statement<\/span><span role=\"button\" tabindex=\"0\" data-code=\"CREATE TABLESPACE auto_seg_ts DATAFILE 'file_2.dbf' SIZE 1M\n   EXTENT MANAGEMENT LOCAL\n   SEGMENT SPACE MANAGEMENT AUTO;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">CREATE<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">TABLESPACE<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">auto_seg_ts<\/span><span style=\"color: #D4D4D4\"> DATAFILE <\/span><span style=\"color: #CE9178\">&#39;file_2.dbf&#39;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">SIZE<\/span><span style=\"color: #D4D4D4\"> 1M<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">   EXTENT MANAGEMENT <\/span><span style=\"color: #569CD6\">LOCAL<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">   SEGMENT SPACE MANAGEMENT <\/span><span style=\"color: #569CD6\">AUTO<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>The minimalistic heavyweight formatter produces this result:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Result by a Minimalistic Heavyweight Formatter<\/span><span role=\"button\" tabindex=\"0\" data-code=\"create tablespace auto_seg_ts datafile 'file_2.dbf' size 1 M extent management local segment space management auto ;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">create<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">tablespace<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">auto_seg_ts<\/span><span style=\"color: #D4D4D4\"> datafile <\/span><span style=\"color: #CE9178\">&#39;file_2.dbf&#39;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">size<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\"> M extent management <\/span><span style=\"color: #569CD6\">local<\/span><span style=\"color: #D4D4D4\"> segment space management <\/span><span style=\"color: #569CD6\">auto<\/span><span style=\"color: #D4D4D4\"> ;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>And the minimalistic lightweight formatter produces this result:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Result by a Minimalistic Lightweight Formatter<\/span><span role=\"button\" tabindex=\"0\" data-code=\"create tablespace auto_seg_ts datafile 'file_2.dbf' size 1M\n   extent management local\n   segment space management auto;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">create<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">tablespace<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">auto_seg_ts<\/span><span style=\"color: #D4D4D4\"> datafile <\/span><span style=\"color: #CE9178\">&#39;file_2.dbf&#39;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">size<\/span><span style=\"color: #D4D4D4\"> 1M<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">   extent management <\/span><span style=\"color: #569CD6\">local<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">   segment space management <\/span><span style=\"color: #569CD6\">auto<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Both formatter changed the case of the keywords and preserved the case of the identifiers. The heavyweight formatter placed a single space between each lexical token, while the lightweight formatter preserved the whitespace. The result of the lightweight formatter looks good because the input was formatted reasonably.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Advantages of a Lightweight Formatter<\/h2>\n\n\n\n<p>I&#8217;m pretty sure that there are no formal formatting rules for a <code>create tablespace<\/code> statement. As a developer, I write and read very seldom such statements. The formatting of this code is not that important to me. Both formatter outputs are acceptable, even if I like the second one better. However, when the <code>create tablespace<\/code> statement contains several <code>file_specification<\/code> clauses then some line breaks would indeed help to improve the readability.<\/p>\n\n\n\n<p>For me, it is completely okay to preserve the original format for a lot of statements such as <code>create tablespace<\/code>, <code>create database<\/code>, <code>create user<\/code>, etc.<\/p>\n\n\n\n<p>However, I&#8217;d like to format code within the following SQL statements:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>create function<\/code><\/li>\n\n\n\n<li><code>create package<\/code><\/li>\n\n\n\n<li><code>create package body<\/code><\/li>\n\n\n\n<li><code>create procedure<\/code><\/li>\n\n\n\n<li><code>create trigger<\/code><\/li>\n\n\n\n<li><code>create type<\/code><\/li>\n\n\n\n<li><code>create type body<\/code><\/li>\n\n\n\n<li><code>create view<\/code><\/li>\n\n\n\n<li><code>delete<\/code><\/li>\n\n\n\n<li><code>insert<\/code><\/li>\n\n\n\n<li><code>merge<\/code><\/li>\n\n\n\n<li><code>select<\/code><\/li>\n\n\n\n<li><code>update<\/code><\/li>\n<\/ul>\n\n\n\n<p>An advantage of a lightweight formatter is that you can implement it incrementally. It is similar to a linter with automatic correction capabilities. Ok, this is probably not that interesting from the user&#8217;s point of view.<\/p>\n\n\n\n<p>Another advantage of a lightweight formatter is that you can support various code styles. For example, you can accept <code>select empno, ename from emp;<\/code> on a single line. But you can also accept optional line breaks before the <code>from_clause<\/code> or between elements in the <code>select_list<\/code>. All variants are compliant with the mentioned code style.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Disadvantages of a Lightweight Formatter<\/h2>\n\n\n\n<p>Simply put a lightweight formatter is a compromise between conformity and individuality. You cannot call the formatter to ensure conformity regardless of the input.<\/p>\n\n\n\n<p>There are a lot of undefined areas where no rules exist. And the developer has in fact the freedom to choose a fitting formatting style in such cases. In my opinion, that&#8217;s fine. And I hope that most developers will love it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">State of the Trivadis PL\/SQL &amp; SQL Formatter Settings<\/h2>\n\n\n\n<p>Originally the Trivadis <a href=\"https:\/\/github.com\/Trivadis\/plsql-formatter-settings\">PL\/SQL &amp; SQL Formatter Settings<\/a> were based on the heavyweight formatter provided by the SQL Developer team. 90% of the Arbori code was their code. I added and changed some Arbori code to amend the formatter result to match my expectations better.<\/p>\n\n\n\n<p>However, I was never really happy with this approach. Why? Because I had to compare the original Arbori code with every new SQL Developer and SQLcl version. Identifying changes was easy. However, understanding the reason for a change was usually a challenge. Some changes conflicted with &#8220;my&#8221; code base. As a result, maintenance became more and more cumbersome.<\/p>\n\n\n\n<p>SQL Developer 20.4.1 and SQLcl 21.1.0 are the first versions for which the lightweight formatter settings are available. At the same time, we stopped to provide settings based on the <a href=\"https:\/\/github.com\/Trivadis\/plsql-formatter-settings\/releases\/tag\/sqlcl-21.1.0\">heavyweight formatter<\/a>. If you need a heavyweight formatter to enforce conformity of your code then you have to rely on the code base provided by the SQL Developer team.<\/p>\n\n\n\n<p>The <a href=\"https:\/\/github.com\/Trivadis\/plsql-formatter-settings\">main branch<\/a> requires the latest versions of SQL Developer and SQLcl. This is currently version 21.2.0 for both products. In my opinion, the lightweight formatter produces reasonable code. It is much easier to identify which rule is responsible for a particular whitespace change due to the rule-based implementation and a unified token-based logging strategy. There are test cases for each rule and a first set of test cases for major grammar elements. At the moment there are more than 470 test cases for about 4000 lines of Arbori code. It&#8217;s not perfect, but I really think that the state of the formatting settings is much better than it ever was before.<\/p>\n\n\n\n<p>If you find strange formatter results then please let us know by <a href=\"https:\/\/github.com\/Trivadis\/plsql-formatter-settings\/issues\/new\">opening a GitHub issue<\/a>. Thank you.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Really Lightweight?<\/h2>\n\n\n\n<p>In some areas, the formatter behaves like a heavyweight formatter without tolerance for individuality.<\/p>\n\n\n\n<p>One reason is that strangely formatted input code should produce reasonably formatted code. See these JUnit <a href=\"https:\/\/github.com\/Trivadis\/plsql-formatter-settings\/blob\/196283ea9284993829b96dd49b851ac309332a66\/tests\/src\/test\/java\/com\/trivadis\/plsql\/formatter\/settings\/examples\/Strange.java\">test cases<\/a> for some examples.<\/p>\n\n\n\n<p>Another reason is that we wanted to apply the calculated indentation for relevant parts of the parse tree. This really helps while writing code. Nobody wants to count spaces. Pressing <code>Ctrl-F7<\/code> to format the code from time to time is much easier. The calculation of the indentation is the most elaborate and extensive code in the current Arbori code base. As a result, some individuality is lost.<\/p>\n\n\n\n<p>Don&#8217;t worry, there is enough individuality left. The following examples show different formatting results using the same formatter settings (Trivadis defaults, &#8220;Line Breaks On subqueries&#8221; unchecked).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/settings_lightweight_formatter.png\"><img loading=\"lazy\" decoding=\"async\" width=\"488\" height=\"537\" src=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/settings_lightweight_formatter.png\" alt=\"\" class=\"wp-image-11245\" srcset=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/settings_lightweight_formatter.png 488w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/settings_lightweight_formatter-273x300.png 273w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/settings_lightweight_formatter-133x146.png 133w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/settings_lightweight_formatter-45x50.png 45w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/settings_lightweight_formatter-68x75.png 68w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/settings_lightweight_formatter-1x1.png 1w\" sizes=\"auto, (max-width:767px) 480px, 488px\" \/><\/a><\/figure>\n\n\n\n<p>The reason for the different results is additional line breaks in the formatter input.<\/p>\n\n\n<div class=\"jq-tabs tabs_wrapper tabs_\"><ul><li><a href=\"#tab-69d049a5c0a89-1\">Single Line<\/a><\/li><li><a href=\"#tab-69d049a5c0a89-2\">Break before 1st from<\/a><\/li><li><a href=\"#tab-69d049a5c0a89-3\">Break before 2nd from<\/a><\/li><li><a href=\"#tab-69d049a5c0a89-4\">Break before subquery<\/a><\/li><li><a href=\"#tab-69d049a5c0a89-5\">Tokenized<\/a><\/li><\/ul><div id=\"tab-69d049a5c0a89-1\" ><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"select e.empno, e.ename, e.job from emp e where e.deptno in (select d.deptno from dept d where d.loc in ('DALLAS', 'CHICAGO'));\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> e.empno, e.ename, e.job <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> emp e <\/span><span style=\"color: #569CD6\">where<\/span><span style=\"color: #D4D4D4\"> e.deptno <\/span><span style=\"color: #569CD6\">in<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> d.deptno <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> dept d <\/span><span style=\"color: #569CD6\">where<\/span><span style=\"color: #D4D4D4\"> d.loc <\/span><span style=\"color: #569CD6\">in<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #CE9178\">&#39;DALLAS&#39;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&#39;CHICAGO&#39;<\/span><span style=\"color: #D4D4D4\">));<\/span><\/span><\/code><\/pre><\/div>\n\n\n<p><\/div><div id=\"tab-69d049a5c0a89-2\" ><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"select e.empno, e.ename, e.job\n  from emp e\n where e.deptno in (select d.deptno from dept d where d.loc in ('DALLAS', 'CHICAGO'));\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> e.empno, e.ename, e.job<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> emp e<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">where<\/span><span style=\"color: #D4D4D4\"> e.deptno <\/span><span style=\"color: #569CD6\">in<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> d.deptno <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> dept d <\/span><span style=\"color: #569CD6\">where<\/span><span style=\"color: #D4D4D4\"> d.loc <\/span><span style=\"color: #569CD6\">in<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #CE9178\">&#39;DALLAS&#39;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&#39;CHICAGO&#39;<\/span><span style=\"color: #D4D4D4\">));<\/span><\/span><\/code><\/pre><\/div>\n\n\n<p><\/div><div id=\"tab-69d049a5c0a89-3\" ><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"select e.empno, e.ename, e.job\n  from emp e\n where e.deptno in (select d.deptno\n                      from dept d\n                     where d.loc in ('DALLAS', 'CHICAGO'));\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> e.empno, e.ename, e.job<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> emp e<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">where<\/span><span style=\"color: #D4D4D4\"> e.deptno <\/span><span style=\"color: #569CD6\">in<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> d.deptno<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                      <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> dept d<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                     <\/span><span style=\"color: #569CD6\">where<\/span><span style=\"color: #D4D4D4\"> d.loc <\/span><span style=\"color: #569CD6\">in<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #CE9178\">&#39;DALLAS&#39;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&#39;CHICAGO&#39;<\/span><span style=\"color: #D4D4D4\">));<\/span><\/span><\/code><\/pre><\/div>\n\n\n<p><\/div><div id=\"tab-69d049a5c0a89-4\" ><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"select e.empno, e.ename, e.job\n  from emp e\n where e.deptno in (\n          select d.deptno\n            from dept d\n           where d.loc in ('DALLAS', 'CHICAGO'));\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> e.empno, e.ename, e.job<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> emp e<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">where<\/span><span style=\"color: #D4D4D4\"> e.deptno <\/span><span style=\"color: #569CD6\">in<\/span><span style=\"color: #D4D4D4\"> (<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">          <\/span><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> d.deptno<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> dept d<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">           <\/span><span style=\"color: #569CD6\">where<\/span><span style=\"color: #D4D4D4\"> d.loc <\/span><span style=\"color: #569CD6\">in<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #CE9178\">&#39;DALLAS&#39;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&#39;CHICAGO&#39;<\/span><span style=\"color: #D4D4D4\">));<\/span><\/span><\/code><\/pre><\/div>\n\n\n<p><\/div><div id=\"tab-69d049a5c0a89-5\" ><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"select e.empno,\n       e.ename,\n       e.job\n  from emp e\n where e.deptno\n       in\n       (\n          select d.deptno\n            from dept d\n           where d.loc\n                 in\n                 (\n                    'DALLAS', 'CHICAGO'\n                 )\n       );\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> e.empno,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">       e.ename,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">       e.job<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> emp e<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">where<\/span><span style=\"color: #D4D4D4\"> e.deptno<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">       <\/span><span style=\"color: #569CD6\">in<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">       (<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">          <\/span><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> d.deptno<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> dept d<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">           <\/span><span style=\"color: #569CD6\">where<\/span><span style=\"color: #D4D4D4\"> d.loc<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                 <\/span><span style=\"color: #569CD6\">in<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                 (<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                    <\/span><span style=\"color: #CE9178\">&#39;DALLAS&#39;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&#39;CHICAGO&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                 )<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">       );<\/span><\/span><\/code><\/pre><\/div>\n\n\n<p><\/div><\/div>\n\n\n\n<p>The &#8220;tokenized&#8221; result is based on an input where each token is placed in a separate line. It shows where line breaks are lost. For example, the second list entry <code>'CHICACO'<\/code> cannot be on a separate line. Short expressions are kept on the same line. Short means less than 50% of the configured max. line width.<\/p>\n\n\n\n<p>For <code>create view<\/code>, <code>select<\/code>, <code>insert<\/code>, <code>update<\/code>, <code>delete<\/code>, <code>merge<\/code> statements and PL\/SQL code I consider the formatter a middleweight. For all other statements (e.g. <code>create tablespace<\/code>) it is really lightweight.<\/p>\n\n\n\n<p>The formatter is also capable of indenting single-line and multi-line comments. This is something that SQL Developer&#8217;s default formatter cannot do yet.<\/p>\n\n\n\n<p>I hope you like the mix of conformity and individuality.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TL;DR Bye bye, heavyweight formatter. Long live the lightweight formatter. Are you using Oracle&#8217;s SQL Developer or SQLcl? Then install these settings and press Ctrl-F7 to produce code that conforms to the Trivadis PL\/SQL &amp; SQL Coding Style. A compromise between conformity and individuality. Heavyweight Formatter A typical PL\/SQL &amp; SQL formatter<span class=\"excerpt-hellip\"> [\u2026]<\/span><\/p>\n","protected":false},"author":1,"featured_media":11256,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[129,135,13,85],"class_list":["post-11201","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle","tag-arbori","tag-javascript","tag-plsql","tag-sql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Lightweight Formatter for PL\/SQL &amp; SQL - Philipp Salvisberg&#039;s Blog<\/title>\n<meta name=\"description\" content=\"Are you using SQL Developer or SQLcl? Then you can use this lightweight formatter. A compromise between conformity and individuality.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Lightweight Formatter for PL\/SQL &amp; SQL - Philipp Salvisberg&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"Are you using SQL Developer or SQLcl? Then you can use this lightweight formatter. A compromise between conformity and individuality.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/\" \/>\n<meta property=\"og:site_name\" content=\"Philipp Salvisberg&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-18T15:09:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-12T12:59:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/leightweight2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"731\" \/>\n\t<meta property=\"og:image:height\" content=\"548\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Philipp Salvisberg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@phsalvisberg\" \/>\n<meta name=\"twitter:site\" content=\"@phsalvisberg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Philipp Salvisberg\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2021\\\/07\\\/18\\\/lightweight-formatter-for-pl-sql-sql\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2021\\\/07\\\/18\\\/lightweight-formatter-for-pl-sql-sql\\\/\"},\"author\":{\"name\":\"Philipp Salvisberg\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#\\\/schema\\\/person\\\/34352245c48678b1a5a05d4bc1339515\"},\"headline\":\"Lightweight Formatter for PL\\\/SQL &#038; SQL\",\"datePublished\":\"2021-07-18T15:09:59+00:00\",\"dateModified\":\"2023-11-12T12:59:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2021\\\/07\\\/18\\\/lightweight-formatter-for-pl-sql-sql\\\/\"},\"wordCount\":1559,\"commentCount\":9,\"publisher\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#\\\/schema\\\/person\\\/34352245c48678b1a5a05d4bc1339515\"},\"image\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2021\\\/07\\\/18\\\/lightweight-formatter-for-pl-sql-sql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/leightweight2.png\",\"keywords\":[\"Arbori\",\"JavaScript\",\"PL\\\/SQL\",\"SQL\"],\"articleSection\":[\"Oracle\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2021\\\/07\\\/18\\\/lightweight-formatter-for-pl-sql-sql\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2021\\\/07\\\/18\\\/lightweight-formatter-for-pl-sql-sql\\\/\",\"url\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2021\\\/07\\\/18\\\/lightweight-formatter-for-pl-sql-sql\\\/\",\"name\":\"Lightweight Formatter for PL\\\/SQL & SQL - Philipp Salvisberg&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2021\\\/07\\\/18\\\/lightweight-formatter-for-pl-sql-sql\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2021\\\/07\\\/18\\\/lightweight-formatter-for-pl-sql-sql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/leightweight2.png\",\"datePublished\":\"2021-07-18T15:09:59+00:00\",\"dateModified\":\"2023-11-12T12:59:14+00:00\",\"description\":\"Are you using SQL Developer or SQLcl? Then you can use this lightweight formatter. A compromise between conformity and individuality.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2021\\\/07\\\/18\\\/lightweight-formatter-for-pl-sql-sql\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2021\\\/07\\\/18\\\/lightweight-formatter-for-pl-sql-sql\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2021\\\/07\\\/18\\\/lightweight-formatter-for-pl-sql-sql\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/leightweight2.png\",\"contentUrl\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/leightweight2.png\",\"width\":731,\"height\":548},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2021\\\/07\\\/18\\\/lightweight-formatter-for-pl-sql-sql\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Lightweight Formatter for PL\\\/SQL &#038; SQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/\",\"name\":\"Philipp Salvisberg&#039;s Blog\",\"description\":\"Database-centric development\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#\\\/schema\\\/person\\\/34352245c48678b1a5a05d4bc1339515\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#\\\/schema\\\/person\\\/34352245c48678b1a5a05d4bc1339515\",\"name\":\"Philipp Salvisberg\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/phs_trivadis4.jpg\",\"url\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/phs_trivadis4.jpg\",\"contentUrl\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/phs_trivadis4.jpg\",\"width\":400,\"height\":400,\"caption\":\"Philipp Salvisberg\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/phs_trivadis4.jpg\"},\"sameAs\":[\"http:\\\/\\\/www.salvis.com\\\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Lightweight Formatter for PL\/SQL & SQL - Philipp Salvisberg&#039;s Blog","description":"Are you using SQL Developer or SQLcl? Then you can use this lightweight formatter. A compromise between conformity and individuality.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/","og_locale":"en_US","og_type":"article","og_title":"Lightweight Formatter for PL\/SQL & SQL - Philipp Salvisberg&#039;s Blog","og_description":"Are you using SQL Developer or SQLcl? Then you can use this lightweight formatter. A compromise between conformity and individuality.","og_url":"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/","og_site_name":"Philipp Salvisberg&#039;s Blog","article_published_time":"2021-07-18T15:09:59+00:00","article_modified_time":"2023-11-12T12:59:14+00:00","og_image":[{"width":731,"height":548,"url":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/leightweight2.png","type":"image\/png"}],"author":"Philipp Salvisberg","twitter_card":"summary_large_image","twitter_creator":"@phsalvisberg","twitter_site":"@phsalvisberg","twitter_misc":{"Written by":"Philipp Salvisberg","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/#article","isPartOf":{"@id":"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/"},"author":{"name":"Philipp Salvisberg","@id":"https:\/\/www.salvis.com\/blog\/#\/schema\/person\/34352245c48678b1a5a05d4bc1339515"},"headline":"Lightweight Formatter for PL\/SQL &#038; SQL","datePublished":"2021-07-18T15:09:59+00:00","dateModified":"2023-11-12T12:59:14+00:00","mainEntityOfPage":{"@id":"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/"},"wordCount":1559,"commentCount":9,"publisher":{"@id":"https:\/\/www.salvis.com\/blog\/#\/schema\/person\/34352245c48678b1a5a05d4bc1339515"},"image":{"@id":"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/leightweight2.png","keywords":["Arbori","JavaScript","PL\/SQL","SQL"],"articleSection":["Oracle"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/","url":"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/","name":"Lightweight Formatter for PL\/SQL & SQL - Philipp Salvisberg&#039;s Blog","isPartOf":{"@id":"https:\/\/www.salvis.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/#primaryimage"},"image":{"@id":"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/leightweight2.png","datePublished":"2021-07-18T15:09:59+00:00","dateModified":"2023-11-12T12:59:14+00:00","description":"Are you using SQL Developer or SQLcl? Then you can use this lightweight formatter. A compromise between conformity and individuality.","breadcrumb":{"@id":"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/#primaryimage","url":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/leightweight2.png","contentUrl":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2021\/07\/leightweight2.png","width":731,"height":548},{"@type":"BreadcrumbList","@id":"https:\/\/www.salvis.com\/blog\/2021\/07\/18\/lightweight-formatter-for-pl-sql-sql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.salvis.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Lightweight Formatter for PL\/SQL &#038; SQL"}]},{"@type":"WebSite","@id":"https:\/\/www.salvis.com\/blog\/#website","url":"https:\/\/www.salvis.com\/blog\/","name":"Philipp Salvisberg&#039;s Blog","description":"Database-centric development","publisher":{"@id":"https:\/\/www.salvis.com\/blog\/#\/schema\/person\/34352245c48678b1a5a05d4bc1339515"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.salvis.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.salvis.com\/blog\/#\/schema\/person\/34352245c48678b1a5a05d4bc1339515","name":"Philipp Salvisberg","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2010\/11\/phs_trivadis4.jpg","url":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2010\/11\/phs_trivadis4.jpg","contentUrl":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2010\/11\/phs_trivadis4.jpg","width":400,"height":400,"caption":"Philipp Salvisberg"},"logo":{"@id":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2010\/11\/phs_trivadis4.jpg"},"sameAs":["http:\/\/www.salvis.com\/"]}]}},"_links":{"self":[{"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/posts\/11201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/comments?post=11201"}],"version-history":[{"count":52,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/posts\/11201\/revisions"}],"predecessor-version":[{"id":12709,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/posts\/11201\/revisions\/12709"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/media\/11256"}],"wp:attachment":[{"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/media?parent=11201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/categories?post=11201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/tags?post=11201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}