<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dbLinter Archives - Philipp Salvisberg&#039;s Blog</title>
	<atom:link href="https://www.salvis.com/blog/tag/dblinter/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.salvis.com/blog/tag/dblinter/</link>
	<description>Database-centric development</description>
	<lastBuildDate>Wed, 18 Feb 2026 08:23:36 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.salvis.com/blog/wp-content/uploads/2014/04/favicon.png</url>
	<title>dbLinter Archives - Philipp Salvisberg&#039;s Blog</title>
	<link>https://www.salvis.com/blog/tag/dblinter/</link>
	<width>32</width>
	<height>32</height>
</image> 
<atom:link rel="hub" href="https://pubsubhubbub.appspot.com"/>
<atom:link rel="hub" href="https://pubsubhubbub.superfeedr.com"/>
<atom:link rel="hub" href="https://websubhub.com/hub"/>
<atom:link rel="self" href="https://www.salvis.com/blog/tag/dblinter/feed/"/>
	<item>
		<title>Fighting Bad PL/SQL &#038; SQL with VS Code</title>
		<link>https://www.salvis.com/blog/2026/01/02/fighting-bad-pl-sql-sql-with-vs-code/</link>
		
		<dc:creator><![CDATA[Philipp Salvisberg]]></dc:creator>
		<pubDate>Fri, 02 Jan 2026 21:05:10 +0000</pubDate>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Code Analysis]]></category>
		<category><![CDATA[dbLinter]]></category>
		<category><![CDATA[PL/SQL]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[VSCode]]></category>
		<guid isPermaLink="false">https://www.salvis.com/blog/?p=14289</guid>

					<description><![CDATA[<p>The success of a project or product depends largely on the quality of the code. But how can I improve security, maintainability or performance? More importantly, how can I prevent code with quality defects from entering production? In addition to testing, code analysis plays a central role. These days, code can be<span class="excerpt-hellip"> […]</span></p>
<p>The post <a href="https://www.salvis.com/blog/2026/01/02/fighting-bad-pl-sql-sql-with-vs-code/">Fighting Bad PL/SQL &amp; SQL with VS Code</a> appeared first on <a href="https://www.salvis.com/blog">Philipp Salvisberg&#039;s Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>The success of a project or product depends largely on the quality of the code. But how can I improve security, maintainability or performance? More importantly, how can I prevent code with quality defects from entering production? In addition to testing, code analysis plays a central role. These days, code can be checked not only in CI/CD pipelines, but also during development. Modern IDEs, such as Visual Studio Code, can automatically detect quality issues and offer quick fixes. The goal is a fast feedback loop.</p>



<p>This blog post is based on my German article with the same title, published in issue 1/2026 of the <a href="https://www.salvis.com/blog/wp-content/uploads/2026/02/01_2026-Red_Stack_Magazin-DTk-WEB-Philipp_Salvisberg_Fighting_Bad_PLSQL__SQL_with_VS_Code.pdf" target="_blank" rel="noreferrer noopener nofollow">Red Stack Magazin</a>.</p>



<h2 class="wp-block-heading" id="measuring-software-quality">Measuring Software Quality</h2>



<p>Imagine you are part of a team where code changes to a feature or bug fix branch are only merged into the develop or main branch following a review. Sometimes you are the author and sometimes one of the reviewers. I am currently part of a team that works in this way. In addition to quality assurance, knowledge sharing is also an important aspect. But how can we assess code quality?</p>



<figure class="wp-block-image is-style-default"><a href="https://www.osnews.com/story/19266/wtfsm/" target="_blank" rel=" noreferrer noopener"><img fetchpriority="high" decoding="async" width="500" height="471" src="https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-1-wtfm.jpg" alt="" class="wp-image-14292" srcset="https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-1-wtfm.jpg 500w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-1-wtfm-300x283.jpg 300w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-1-wtfm-80x75.jpg 80w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-1-wtfm-480x452.jpg 480w" sizes="(max-width:767px) 480px, 500px" /></a><figcaption class="wp-element-caption">Figure 1: WTFs/m</figcaption></figure>



<p>This well-known meme by Thom Holwerda says, &#8220;The only valid measurement of code quality is WTFs per minute.&#8221; This seems to be a good metric. However, this metric does have some flaws.</p>



<ul class="wp-block-list">
<li>It is subjective.</li>



<li>It does not provide any information about what is being assessed.</li>



<li>It does not help new team members to adapt quickly.</li>



<li>And it cannot be automated in a meaningful way.</li>
</ul>



<p>Sooner or later, a team has no choice but to agree on a set of rules. They can be informal or formal. Typical coding guidelines cover topics such as naming conventions, formatting, code complexity, and language usage rules. The aim is to define and comply with quality standards relating to maintainability, reliability, performance and security. Written coding guidelines also simplify the onboarding of new team members.</p>



<h2 class="wp-block-heading" id="automation">Automation</h2>



<p>Manually checking compliance with coding guidelines as part of a review is so time-consuming that no one can afford to do it properly. Therefore, we have to automate as many checks as possible. This is possible for many aspects. The rest still have to be checked manually.</p>



<p>In other words, we need a tool suite for automatic rule checking. <a href="https://grisselbav.github.io/dbLinter/" target="_blank" rel="noreferrer noopener nofollow">dbLinter</a> is such a tool suite. It is a new product developed and continuously improved by <a href="https://www.grisselbav.com/" target="_blank" rel="noreferrer noopener nofollow">Grisselbav</a> and <a href="https://www.united-codes.com/" target="_blank" rel="noreferrer noopener nofollow">United Codes</a>. dbLinter uses the <a href="https://github.com/IslandSQL/IslandSQL" target="_blank" rel="noreferrer noopener nofollow">IslandSQL</a> parser, which is updated quarterly with every release update of the Oracle AI Database for SQL, PL/SQL, SQL*Plus and SQLcl.</p>



<p>dbLinter is the successor to the decommissioned db* CODECOP suite. dbLinter consists of a central repository, a web GUI and client tools. These include a CLI, a SonarQube plugin and a VS Code extension.</p>



<h2 class="wp-block-heading" id="visual-studio-code-extension">Visual Studio Code Extension</h2>



<p>The VS Code extension is compatible with all IDEs that implement the <a href="https://code.visualstudio.com/api" target="_blank" rel="noreferrer noopener nofollow">Visual Studio Code Extension API</a>. Specifically: Visual Studio Code, Theia IDE, VSCodium, Cursor, Windsurf, Void, Kiro and Antigravity.</p>



<p>dbLinter for VS Code is available in both the <a href="https://marketplace.visualstudio.com/items?itemName=Grisselbav.dblinter" target="_blank" rel="noreferrer noopener nofollow">Visual Studio Marketplace</a> and the <a href="https://open-vsx.org/extension/Grisselbav/dblinter" target="_blank" rel="noreferrer noopener nofollow">Open VSX Registry</a>. Therefore, it can be conveniently installed directly from the IDE. The extension is free to use as part of the Anonymous and Starter plans (see <a href="https://www.united-codes.com/products/dblinter/#pricing" target="_blank" rel="noreferrer noopener nofollow">dbLinter Pricing Plans</a>).</p>



<p>It is important to note that your code is always analysed locally, meaning that it never leaves your network. The configuration is read from the central repository, enabling the client to identify the active rules and parameters. These configurations, along with others, are managed using the <a href="https://dblinter.app/" target="_blank" rel="noreferrer noopener nofollow">Web GUI</a>.</p>



<figure class="wp-block-image size-full"><a href="https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-2-dblinter-regel-konfiguration-im-web-gui.png"><img decoding="async" width="1228" height="1088" src="https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-2-dblinter-regel-konfiguration-im-web-gui.png" alt="" class="wp-image-14313" srcset="https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-2-dblinter-regel-konfiguration-im-web-gui.png 1228w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-2-dblinter-regel-konfiguration-im-web-gui-300x266.png 300w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-2-dblinter-regel-konfiguration-im-web-gui-1024x907.png 1024w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-2-dblinter-regel-konfiguration-im-web-gui-768x680.png 768w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-2-dblinter-regel-konfiguration-im-web-gui-85x75.png 85w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-2-dblinter-regel-konfiguration-im-web-gui-480x425.png 480w" sizes="(max-width:767px) 480px, (max-width:1228px) 100vw, 1228px" /></a><figcaption class="wp-element-caption">Figure 2: dbLinter rule configuration in the Web GUI</figcaption></figure>



<p>dbLinter currently offers 187 rules. This includes all the rules from the decommissioned Trivadis PL/SQL &amp; SQL Coding Guidelines. Figure 2 shows the configuration of my 14 favourite rules. A violation of one of these rules is a bug. There is almost no room for interpretation here. The following chapters provide two examples.</p>



<h2 class="wp-block-heading top-n-queries-with-rownum">Top-N Queries with ROWNUM</h2>



<p>The query in Listing 1 is based on the well-known <code>EMP</code> table owned by the database user <code>SCOTT</code>. It returns two rows.</p>



<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">Listing 1: Defective pre-12c-style top-n query</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>select ename,
       sal,
       hiredate,
       rownum as rank
  from emp
 where rownum &lt;= 2
 order by sal desc;</textarea></pre><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"> ename,</span></span>
<span class="line"><span style="color: #D4D4D4">       sal,</span></span>
<span class="line"><span style="color: #D4D4D4">       hiredate,</span></span>
<span class="line"><span style="color: #D4D4D4">       </span><span style="color: #569CD6">rownum</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">as</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">rank</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> emp</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">where</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">rownum</span><span style="color: #D4D4D4"> &lt;= </span><span style="color: #B5CEA8">2</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">order by</span><span style="color: #D4D4D4"> sal </span><span style="color: #569CD6">desc</span><span style="color: #D4D4D4">;</span></span></code></pre></div>



<div class="wp-block-kevinbatdorf-code-block-pro" 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-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>ENAME             SAL HIREDATE         RANK
---------- ---------- ---------- ----------
ALLEN            1600 20.02.1981          2
SMITH             800 17.12.1980          1</textarea></pre><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: #D4D4D4">ENAME             SAL HIREDATE         RANK</span></span>
<span class="line"><span style="color: #D4D4D4">---------- ---------- ---------- ----------</span></span>
<span class="line"><span style="color: #D4D4D4">ALLEN            1600 20.02.1981          2</span></span>
<span class="line"><span style="color: #D4D4D4">SMITH             800 17.12.1980          1</span></span></code></pre></div>



<p>However, the result barely meets the requirements. I would have expected the two employees with the highest salaries to be returned. Why is this not the case? The query is formulated in such a way that two rows are randomly selected and then sorted in descending order by salary. The result depends on the execution plan and the physical storage of the data.</p>



<figure class="wp-block-image size-full"><a href="https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-3-g-3185-regelverletzung-in-vs-code.png"><img decoding="async" width="913" height="448" src="https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-3-g-3185-regelverletzung-in-vs-code.png" alt="" class="wp-image-14323" srcset="https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-3-g-3185-regelverletzung-in-vs-code.png 913w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-3-g-3185-regelverletzung-in-vs-code-300x147.png 300w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-3-g-3185-regelverletzung-in-vs-code-768x377.png 768w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-3-g-3185-regelverletzung-in-vs-code-150x75.png 150w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-3-g-3185-regelverletzung-in-vs-code-480x236.png 480w" sizes="(max-width:767px) 480px, (max-width:913px) 100vw, 913px" /></a><figcaption class="wp-element-caption">Figure 3: Violation of rule G-3185 in VS Code</figcaption></figure>



<p>In VS Code, rule violations are displayed under <code>Problems</code> (see Figure 3). There is also a <a href="https://dblinter.app/ords/r/dblinter/dblinter-console/rules#P1000_SHOW_RULE=core%20g-3185" target="_blank" rel="noreferrer noopener nofollow">Core G-3185</a> link that opens the rule details in the Web GUI.</p>



<figure class="wp-block-image size-full"><a href="https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-4-g-3185-im-dblinter-web-gui-2.png"><img loading="lazy" decoding="async" width="982" height="1490" src="https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-4-g-3185-im-dblinter-web-gui-2.png" alt="" class="wp-image-14330" srcset="https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-4-g-3185-im-dblinter-web-gui-2.png 982w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-4-g-3185-im-dblinter-web-gui-2-198x300.png 198w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-4-g-3185-im-dblinter-web-gui-2-675x1024.png 675w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-4-g-3185-im-dblinter-web-gui-2-768x1165.png 768w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-4-g-3185-im-dblinter-web-gui-2-49x75.png 49w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-4-g-3185-im-dblinter-web-gui-2-480x728.png 480w" sizes="auto, (max-width:767px) 480px, (max-width:982px) 100vw, 982px" /></a><figcaption class="wp-element-caption">Figure 4: Rule G-3185 in the dbLinter Web GUI</figcaption></figure>



<p>Rule G-3185 in the web GUI is explained based on a similar case in the HR schema (see Figure 4). There are two solutions here. One that can be applied in all Oracle Database versions and one that works from version 12c onwards. Listing 2 shows the traditional solution, which uses an inline view. Of course, nowadays I would always prefer a solution using the <a href="https://docs.oracle.com/en/database/oracle/oracle-database/26/sqlrf/SELECT.html#GUID-CFA006CA-6FF1-4972-821E-6996142A51C6__BABBADDD" target="_blank" rel="noreferrer noopener nofollow">row_limiting_clause</a>.</p>



<p>We can also see that the rule is used in six configurations. Clicking on &#8220;(details)&#8221; opens a pop-up window in which changes can be made. This allows you to configure the rules directly from the IDE.</p>



<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:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7">Listing 2: Fixed pre-12c-style top-n query</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>select e.*,
       rownum as rank
  from (
          select ename,
                 sal,
                 hiredate
            from emp
           order by sal desc
       ) e
 where rownum &lt;= 2;</textarea></pre><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.*,</span></span>
<span class="line"><span style="color: #D4D4D4">       </span><span style="color: #569CD6">rownum</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">as</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">rank</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> (</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #569CD6">select</span><span style="color: #D4D4D4"> ename,</span></span>
<span class="line"><span style="color: #D4D4D4">                 sal,</span></span>
<span class="line"><span style="color: #D4D4D4">                 hiredate</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> emp</span></span>
<span class="line"><span style="color: #D4D4D4">           </span><span style="color: #569CD6">order by</span><span style="color: #D4D4D4"> sal </span><span style="color: #569CD6">desc</span></span>
<span class="line"><span style="color: #D4D4D4">       ) e</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">where</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">rownum</span><span style="color: #D4D4D4"> &lt;= </span><span style="color: #B5CEA8">2</span><span style="color: #D4D4D4">;</span></span></code></pre></div>



<div class="wp-block-kevinbatdorf-code-block-pro" 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-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>ENAME             SAL HIREDATE         RANK
---------- ---------- ---------- ----------
KING             5000 17.11.1981          1
SCOTT            3000 19.04.1987          2</textarea></pre><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: #D4D4D4">ENAME             SAL HIREDATE         RANK</span></span>
<span class="line"><span style="color: #D4D4D4">---------- ---------- ---------- ----------</span></span>
<span class="line"><span style="color: #D4D4D4">KING             5000 17.11.1981          1</span></span>
<span class="line"><span style="color: #D4D4D4">SCOTT            3000 19.04.1987          2</span></span></code></pre></div>



<h2 class="wp-block-heading nvl-vs-coalesce">NVL vs. COALESCE</h2>



<p>One often underestimated rule is &#8220;<a href="https://dblinter.app/ords/r/dblinter/dblinter-console/rules#P1000_SHOW_RULE=core%20g-4230" target="_blank" rel="noreferrer noopener nofollow">G-4230</a>: Always use a COALESCE instead of a NVL command, if parameter 2 of the NVL function is a function call or a SELECT statement&#8221;. This rule is about performance, which is relevant to all of us, especially when it is poor. This is why this rule is important.</p>



<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">Listing 3: Bad performance with NVL</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>with
   function slow_function return integer is
   begin
      sys.dbms_session.sleep(0.2);
      return null;
   end slow_function;
select ename, nvl(mgr, slow_function()) as mgr
  from emp;</textarea></pre><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">with</span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #569CD6">function</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">slow_function</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">return</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">integer</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">is</span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #569CD6">begin</span></span>
<span class="line"><span style="color: #D4D4D4">      sys.</span><span style="color: #DCDCAA">dbms_session.</span><span style="color: #4EC9B0">sleep</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">0.2</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #C586C0">return</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">null</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #569CD6">end</span><span style="color: #D4D4D4"> slow_function;</span></span>
<span class="line"><span style="color: #569CD6">select</span><span style="color: #D4D4D4"> ename, </span><span style="color: #DCDCAA">nvl</span><span style="color: #D4D4D4">(mgr, slow_function()) </span><span style="color: #569CD6">as</span><span style="color: #D4D4D4"> mgr</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> emp;</span></span></code></pre></div>



<p>Listing 3 demonstrates a case in which the use of <code>NVL</code> results in an execution time of approximately 2.8 seconds. If <code>COALESCE</code> is used instead of <code>NVL</code>, the execution time is only about 0.2 seconds. The reason is that <code>NVL</code> always evaluates the second parameter, even if the first parameter is not null. <code>COALESCE</code> works differently: the second parameter is only evaluated if the first parameter is null. This performance difference originates from the fact that the <code>EMP</code> table contains 14 rows, but only one of these returns an empty <code>MGR</code>.</p>



<p>In this case, using <code>COALESCE</code> is definitely the better solution. So, should <code>NVL</code> always be replaced by <code>COALESCE</code>? No. There are two special cases:</p>



<ol class="wp-block-list">
<li>NVL supports implicit data type conversion.<br /><code>select nvl(mgr, '1') from emp</code> works, but <code>select coalesce(mgr, '1') from emp</code> causes an <a href="https://docs.oracle.com/en/error-help/db/ora-00932/" target="_blank" rel="noreferrer noopener nofollow">ORA-00932</a> error. However, implicit type conversions should be avoided anyway. The code should be adjusted accordingly.<br /></li>



<li>Optimisations of <code>NVL</code> can lead to better execution plans.<br />Such optimisations currently only exist for <code>NVL</code> and not for <code>COALESCE</code>. Therefore, it is better to continue using <code>NVL</code> in these cases. See <a href="https://how2ora-en.blogspot.com/2025/09/the-magical-nvl-function.html" target="_blank" rel="noreferrer noopener nofollow">The Magical NVL Function</a> by Monika Lewandowska for an example. </li>
</ol>



<h5 class="wp-block-heading">Quick Fixes</h5>



<p>dbLinter knows these special cases. It offers appropriate alternative solutions. See Figure 5.</p>



<figure class="wp-block-image size-full"><a href="https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-5-g-4230-quick-fixes-in-vscode.png"><img loading="lazy" decoding="async" width="1121" height="717" src="https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-5-g-4230-quick-fixes-in-vscode.png" alt="" class="wp-image-14346" srcset="https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-5-g-4230-quick-fixes-in-vscode.png 1121w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-5-g-4230-quick-fixes-in-vscode-300x192.png 300w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-5-g-4230-quick-fixes-in-vscode-1024x655.png 1024w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-5-g-4230-quick-fixes-in-vscode-768x491.png 768w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-5-g-4230-quick-fixes-in-vscode-117x75.png 117w, https://www.salvis.com/blog/wp-content/uploads/2026/01/abbildung-5-g-4230-quick-fixes-in-vscode-480x307.png 480w" sizes="auto, (max-width:767px) 480px, (max-width:1121px) 100vw, 1121px" /></a><figcaption class="wp-element-caption">Figure 5: Quick fixes for G-4230 violation in VS Code.</figcaption></figure>



<p>dbLinter can apply quick fixes to different sections. For example, for a single violation of a rule, for all violations of a rule, or for all violations of all rules in the editor window.</p>



<p>The &#8220;@dbLinter ignore markers&#8221; are special comments used to ignore rule violations. There are various legitimate reasons for doing this. For example, in the case of false positives (dbLinter bugs) or exceptions to the rule. A comment such as <code>-- @dbLinter ignore(G-4230): NVL forever</code> can have the following scopes: line, statement or file, depending on where the comment is positioned.</p>



<h2 class="wp-block-heading" id="code-analysis-and-ai">Code Analysis and AI</h2>



<p>The solution proposals in Figure 5, indicated by the yellow lamp symbol, are quick fixes from dbLinter. However, the last two menu options come from GitHub Copilot.</p>



<p>When Copilot suggests a solution to a rule violation, dbLinter provides the necessary context, including the file and the exact location of the violation, as well as the name of the violated rule. This gives Copilot access to the rule definition online, enabling it to suggest a reasonable solution in many cases. In other words, dbLinter enhances the support offered by tools such as Copilot, Cline and Windsurf.</p>



<p>Rules are useful for AI tools. They provide a framework that leads to better results. However, there is no guarantee that all rules will be followed. Ultimately, code generated or expanded by AI becomes part of our code base. This is why it is important to check AI-generated code according to the same rules as manually created code.</p>



<p>In other words, AI does not enforce standards. But dbLinter can do that.</p>



<h2 class="wp-block-heading" id="conclusion">Conclusion</h2>



<p>Software quality is a matter of definition. dbLinter offers many rules. Not all of them are useful and applicable to every project. The dbLinter rules can therefore be seen as a large buffet. You choose what you like and what is healthy. But not too much at once. Nevertheless, there are some rules that, in my opinion, should be followed in every project. I have presented two of them in this blog post.</p>



<p>Install dbLinter for VS Code to identify the rules that will be most helpful for your projects. The rules in Figure 2 are certainly a good starting point.</p>



<p>If you have any questions, please feel free to contact me. Alternatively, you can create issues directly in the <a href="https://github.com/Grisselbav/dbLinter" target="_blank" rel="noreferrer noopener nofollow">dbLinter GitHub repository</a>.</p>



<p></p>
<p>The post <a href="https://www.salvis.com/blog/2026/01/02/fighting-bad-pl-sql-sql-with-vs-code/">Fighting Bad PL/SQL &amp; SQL with VS Code</a> appeared first on <a href="https://www.salvis.com/blog">Philipp Salvisberg&#039;s Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Outer Joining With ANSI SQL-89 and SQL-92</title>
		<link>https://www.salvis.com/blog/2025/07/12/outer-joining-with-ansi-sql-89-and-sql-92/</link>
		
		<dc:creator><![CDATA[Philipp Salvisberg]]></dc:creator>
		<pubDate>Sat, 12 Jul 2025 15:20:05 +0000</pubDate>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Code Analysis]]></category>
		<category><![CDATA[dbLinter]]></category>
		<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">https://www.salvis.com/blog/?p=13988</guid>

					<description><![CDATA[<p>Introduction I recently implemented a quick fix for the rule G-3130 to transform queries to ANSI SQL-92 syntax. One of the challenges was to handle Oracle&#8217;s outer-join syntax (+). In ANSI SQL-89, join and filter criteria are part of the WHERE clause. It&#8217;s not easy to distinguish them. In this blog post,<span class="excerpt-hellip"> […]</span></p>
<p>The post <a href="https://www.salvis.com/blog/2025/07/12/outer-joining-with-ansi-sql-89-and-sql-92/">Outer Joining With ANSI SQL-89 and SQL-92</a> appeared first on <a href="https://www.salvis.com/blog">Philipp Salvisberg&#039;s Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Introduction</h2>



<p>I recently implemented a quick fix for the rule <a href="https://dblinter-rules.united-codes.com/rules/G-3130/">G-3130</a> to transform queries to ANSI SQL-92 syntax. One of the challenges was to handle Oracle&#8217;s outer-join syntax <code>(+)</code>. In ANSI SQL-89, join and filter criteria are part of the WHERE clause.  It&#8217;s not easy to distinguish them. In this blog post, I explain why it is important to do that when using outer joins, regardless of which join syntax you prefer.</p>



<h2 class="wp-block-heading">Data Setup</h2>



<p>All examples in this blog post are based on the tables <code>DEPT</code> and <code>EMP</code>, that were originally present in every Oracle Database instance as part of the <code>SCOTT</code> schema. Here&#8217;s a script to create these tables. The script requires an Oracle Database 23ai. </p>



<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:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7">1) Create table DEPT and EMP</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>create table if not exists dept as select * from (values
          (10, 'ACCOUNTING', 'NEW YORK'),
          (20, 'RESEARCH',   'DALLAS'),
          (30, 'SALES',      'CHICAGO'),
          (40, 'OPERATIONS', 'BOSTON')
       ) s (deptno, dname, loc);

create table if not exists emp as select * from (values
          (7839, 'KING',   'PRESIDENT', null, date '1981-11-17', 5000, null, 10),
          (7566, 'JONES',  'MANAGER',   7839, date '1981-04-02', 2975, null, 20),
          (7698, 'BLAKE',  'MANAGER',   7839, date '1981-05-01', 2850, null, 30),
          (7782, 'CLARK',  'MANAGER',   7839, date '1981-06-09', 2450, null, 10),
          (7788, 'SCOTT',  'ANALYST',   7566, date '1987-04-19', 3000, null, 20),
          (7902, 'FORD',   'ANALYST',   7566, date '1981-12-03', 3000, null, 20),
          (7499, 'ALLEN',  'SALESMAN',  7698, date '1981-02-20', 1600,  300, 30),
          (7521, 'WARD',   'SALESMAN',  7698, date '1981-02-22', 1250,  500, 30),
          (7654, 'MARTIN', 'SALESMAN',  7698, date '1981-09-28', 1250, 1400, 30),
          (7844, 'TURNER', 'SALESMAN',  7698, date '1981-09-08', 1500,    0, 30),
          (7900, 'JAMES',  'CLERK',     7698, date '1981-12-03',  950, null, 30),
          (7934, 'MILLER', 'CLERK',     7782, date '1982-01-23', 1300, null, 10),
          (7369, 'SMITH',  'CLERK',     7902, date '1980-12-17',  800, null, 20),
          (7876, 'ADAMS',  'CLERK',     7788, date '1987-05-23', 1100, null, 20)
       ) s (empno, ename, job, mgr, hiredate, sal, comm, deptno);</textarea></pre><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: #9CDCFE">create</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">table</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">not</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">exists</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">dept</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">as</span><span style="color: #D4D4D4"> </span><span style="color: #4EC9B0">select</span><span style="color: #D4D4D4"> * </span><span style="color: #4EC9B0">from</span><span style="color: #D4D4D4"> (</span><span style="color: #4EC9B0">values</span></span>
<span class="line"><span style="color: #D4D4D4">          (10, </span><span style="color: #CE9178">&#39;ACCOUNTING&#39;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&#39;NEW YORK&#39;</span><span style="color: #D4D4D4">),</span></span>
<span class="line"><span style="color: #D4D4D4">          (20, </span><span style="color: #CE9178">&#39;RESEARCH&#39;</span><span style="color: #D4D4D4">,   </span><span style="color: #CE9178">&#39;DALLAS&#39;</span><span style="color: #D4D4D4">),</span></span>
<span class="line"><span style="color: #D4D4D4">          (30, </span><span style="color: #CE9178">&#39;SALES&#39;</span><span style="color: #D4D4D4">,      </span><span style="color: #CE9178">&#39;CHICAGO&#39;</span><span style="color: #D4D4D4">),</span></span>
<span class="line"><span style="color: #D4D4D4">          (40, </span><span style="color: #CE9178">&#39;OPERATIONS&#39;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&#39;BOSTON&#39;</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">       ) </span><span style="color: #4EC9B0">s</span><span style="color: #D4D4D4"> (</span><span style="color: #9CDCFE">deptno</span><span style="color: #D4D4D4">, </span><span style="color: #9CDCFE">dname</span><span style="color: #D4D4D4">, </span><span style="color: #9CDCFE">loc</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #9CDCFE">create</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">table</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">not</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">exists</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">emp</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">as</span><span style="color: #D4D4D4"> </span><span style="color: #4EC9B0">select</span><span style="color: #D4D4D4"> * </span><span style="color: #4EC9B0">from</span><span style="color: #D4D4D4"> (</span><span style="color: #4EC9B0">values</span></span>
<span class="line"><span style="color: #D4D4D4">          (7839, </span><span style="color: #CE9178">&#39;KING&#39;</span><span style="color: #D4D4D4">,   </span><span style="color: #CE9178">&#39;PRESIDENT&#39;</span><span style="color: #D4D4D4">, </span><span style="color: #9CDCFE">null</span><span style="color: #D4D4D4">, </span><span style="color: #9CDCFE">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-11-17&#39;</span><span style="color: #D4D4D4">, 5000, </span><span style="color: #9CDCFE">null</span><span style="color: #D4D4D4">, 10),</span></span>
<span class="line"><span style="color: #D4D4D4">          (7566, </span><span style="color: #CE9178">&#39;JONES&#39;</span><span style="color: #D4D4D4">,  </span><span style="color: #CE9178">&#39;MANAGER&#39;</span><span style="color: #D4D4D4">,   7839, </span><span style="color: #9CDCFE">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-04-02&#39;</span><span style="color: #D4D4D4">, 2975, </span><span style="color: #9CDCFE">null</span><span style="color: #D4D4D4">, 20),</span></span>
<span class="line"><span style="color: #D4D4D4">          (7698, </span><span style="color: #CE9178">&#39;BLAKE&#39;</span><span style="color: #D4D4D4">,  </span><span style="color: #CE9178">&#39;MANAGER&#39;</span><span style="color: #D4D4D4">,   7839, </span><span style="color: #9CDCFE">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-05-01&#39;</span><span style="color: #D4D4D4">, 2850, </span><span style="color: #9CDCFE">null</span><span style="color: #D4D4D4">, 30),</span></span>
<span class="line"><span style="color: #D4D4D4">          (7782, </span><span style="color: #CE9178">&#39;CLARK&#39;</span><span style="color: #D4D4D4">,  </span><span style="color: #CE9178">&#39;MANAGER&#39;</span><span style="color: #D4D4D4">,   7839, </span><span style="color: #9CDCFE">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-06-09&#39;</span><span style="color: #D4D4D4">, 2450, </span><span style="color: #9CDCFE">null</span><span style="color: #D4D4D4">, 10),</span></span>
<span class="line"><span style="color: #D4D4D4">          (7788, </span><span style="color: #CE9178">&#39;SCOTT&#39;</span><span style="color: #D4D4D4">,  </span><span style="color: #CE9178">&#39;ANALYST&#39;</span><span style="color: #D4D4D4">,   7566, </span><span style="color: #9CDCFE">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1987-04-19&#39;</span><span style="color: #D4D4D4">, 3000, </span><span style="color: #9CDCFE">null</span><span style="color: #D4D4D4">, 20),</span></span>
<span class="line"><span style="color: #D4D4D4">          (7902, </span><span style="color: #CE9178">&#39;FORD&#39;</span><span style="color: #D4D4D4">,   </span><span style="color: #CE9178">&#39;ANALYST&#39;</span><span style="color: #D4D4D4">,   7566, </span><span style="color: #9CDCFE">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-12-03&#39;</span><span style="color: #D4D4D4">, 3000, </span><span style="color: #9CDCFE">null</span><span style="color: #D4D4D4">, 20),</span></span>
<span class="line"><span style="color: #D4D4D4">          (7499, </span><span style="color: #CE9178">&#39;ALLEN&#39;</span><span style="color: #D4D4D4">,  </span><span style="color: #CE9178">&#39;SALESMAN&#39;</span><span style="color: #D4D4D4">,  7698, </span><span style="color: #9CDCFE">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-02-20&#39;</span><span style="color: #D4D4D4">, 1600,  300, 30),</span></span>
<span class="line"><span style="color: #D4D4D4">          (7521, </span><span style="color: #CE9178">&#39;WARD&#39;</span><span style="color: #D4D4D4">,   </span><span style="color: #CE9178">&#39;SALESMAN&#39;</span><span style="color: #D4D4D4">,  7698, </span><span style="color: #9CDCFE">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-02-22&#39;</span><span style="color: #D4D4D4">, 1250,  500, 30),</span></span>
<span class="line"><span style="color: #D4D4D4">          (7654, </span><span style="color: #CE9178">&#39;MARTIN&#39;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&#39;SALESMAN&#39;</span><span style="color: #D4D4D4">,  7698, </span><span style="color: #9CDCFE">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-09-28&#39;</span><span style="color: #D4D4D4">, 1250, 1400, 30),</span></span>
<span class="line"><span style="color: #D4D4D4">          (7844, </span><span style="color: #CE9178">&#39;TURNER&#39;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&#39;SALESMAN&#39;</span><span style="color: #D4D4D4">,  7698, </span><span style="color: #9CDCFE">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-09-08&#39;</span><span style="color: #D4D4D4">, 1500,    0, 30),</span></span>
<span class="line"><span style="color: #D4D4D4">          (7900, </span><span style="color: #CE9178">&#39;JAMES&#39;</span><span style="color: #D4D4D4">,  </span><span style="color: #CE9178">&#39;CLERK&#39;</span><span style="color: #D4D4D4">,     7698, </span><span style="color: #9CDCFE">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-12-03&#39;</span><span style="color: #D4D4D4">,  950, </span><span style="color: #9CDCFE">null</span><span style="color: #D4D4D4">, 30),</span></span>
<span class="line"><span style="color: #D4D4D4">          (7934, </span><span style="color: #CE9178">&#39;MILLER&#39;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&#39;CLERK&#39;</span><span style="color: #D4D4D4">,     7782, </span><span style="color: #9CDCFE">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1982-01-23&#39;</span><span style="color: #D4D4D4">, 1300, </span><span style="color: #9CDCFE">null</span><span style="color: #D4D4D4">, 10),</span></span>
<span class="line"><span style="color: #D4D4D4">          (7369, </span><span style="color: #CE9178">&#39;SMITH&#39;</span><span style="color: #D4D4D4">,  </span><span style="color: #CE9178">&#39;CLERK&#39;</span><span style="color: #D4D4D4">,     7902, </span><span style="color: #9CDCFE">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1980-12-17&#39;</span><span style="color: #D4D4D4">,  800, </span><span style="color: #9CDCFE">null</span><span style="color: #D4D4D4">, 20),</span></span>
<span class="line"><span style="color: #D4D4D4">          (7876, </span><span style="color: #CE9178">&#39;ADAMS&#39;</span><span style="color: #D4D4D4">,  </span><span style="color: #CE9178">&#39;CLERK&#39;</span><span style="color: #D4D4D4">,     7788, </span><span style="color: #9CDCFE">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1987-05-23&#39;</span><span style="color: #D4D4D4">, 1100, </span><span style="color: #9CDCFE">null</span><span style="color: #D4D4D4">, 20)</span></span>
<span class="line"><span style="color: #D4D4D4">       ) </span><span style="color: #4EC9B0">s</span><span style="color: #D4D4D4"> (</span><span style="color: #9CDCFE">empno</span><span style="color: #D4D4D4">, </span><span style="color: #9CDCFE">ename</span><span style="color: #D4D4D4">, </span><span style="color: #9CDCFE">job</span><span style="color: #D4D4D4">, </span><span style="color: #9CDCFE">mgr</span><span style="color: #D4D4D4">, </span><span style="color: #9CDCFE">hiredate</span><span style="color: #D4D4D4">, </span><span style="color: #9CDCFE">sal</span><span style="color: #D4D4D4">, </span><span style="color: #9CDCFE">comm</span><span style="color: #D4D4D4">, </span><span style="color: #9CDCFE">deptno</span><span style="color: #D4D4D4">);</span></span></code></pre></div>



<h2 class="wp-block-heading">Joins</h2>



<p>The predecessor of the ANSI SQL-92 standard is the ANSI SQL-89 standard. Based on that standard, you could write joins only like this:</p>



<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);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);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">2) ANSI SQL-89 Join</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>select dept.deptno, emp.ename
  from dept, emp
 where emp.deptno = dept.deptno
 order by dept.deptno, emp.ename;</textarea></pre><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"> dept.deptno, emp.ename</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> dept, emp</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">where</span><span style="color: #D4D4D4"> emp.deptno = dept.deptno</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">order by</span><span style="color: #D4D4D4"> dept.deptno, emp.ename;</span></span></code></pre></div>



<div class="wp-block-kevinbatdorf-code-block-pro" 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-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>    DEPTNO ENAME 
---------- ------
        10 CLARK 
        10 KING  
        10 MILLER
        20 ADAMS 
        20 FORD  
        20 JONES 
        20 SCOTT 
        20 SMITH 
        30 ALLEN 
        30 BLAKE 
        30 JAMES 
        30 MARTIN
        30 TURNER
        30 WARD  

14 rows selected. </textarea></pre><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: #D4D4D4">    DEPTNO ENAME </span></span>
<span class="line"><span style="color: #D4D4D4">---------- ------</span></span>
<span class="line"><span style="color: #D4D4D4">        10 CLARK </span></span>
<span class="line"><span style="color: #D4D4D4">        10 KING  </span></span>
<span class="line"><span style="color: #D4D4D4">        10 MILLER</span></span>
<span class="line"><span style="color: #D4D4D4">        20 ADAMS </span></span>
<span class="line"><span style="color: #D4D4D4">        20 FORD  </span></span>
<span class="line"><span style="color: #D4D4D4">        20 JONES </span></span>
<span class="line"><span style="color: #D4D4D4">        20 SCOTT </span></span>
<span class="line"><span style="color: #D4D4D4">        20 SMITH </span></span>
<span class="line"><span style="color: #D4D4D4">        30 ALLEN </span></span>
<span class="line"><span style="color: #D4D4D4">        30 BLAKE </span></span>
<span class="line"><span style="color: #D4D4D4">        30 JAMES </span></span>
<span class="line"><span style="color: #D4D4D4">        30 MARTIN</span></span>
<span class="line"><span style="color: #D4D4D4">        30 TURNER</span></span>
<span class="line"><span style="color: #D4D4D4">        30 WARD  </span></span>
<span class="line"><span style="color: #D4D4D4"></span></span>
<span class="line"><span style="color: #D4D4D4">14 rows selected. </span></span></code></pre></div>



<p>In the FROM clause, we list the tables to be joined, and in the WHERE clause, we define the JOIN criteria. There are no filter criteria in this case.</p>



<p>There are several ways to transform this query to ANSI SQL-92. One rather silly way, but very similar to the original ANSI SQL-89 syntax, is the use of an explicit CROSS JOIN.</p>



<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);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);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">3) ANSI SQL-92 Cross Join </span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>select dept.deptno, emp.ename
  from dept cross join emp
 where emp.deptno = dept.deptno
 order by dept.deptno, emp.ename;</textarea></pre><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"> dept.deptno, emp.ename</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> dept </span><span style="color: #569CD6">cross join</span><span style="color: #D4D4D4"> emp</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">where</span><span style="color: #D4D4D4"> emp.deptno = dept.deptno</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">order by</span><span style="color: #D4D4D4"> dept.deptno, emp.ename;</span></span></code></pre></div>



<p>While this is technically an ANSI SQL-92 compliant query, it&#8217;s not a good option. Why? &#8211; ANSI SQL-92 allows us to define the join criteria for each join. Using a CROSS JOIN implies that there is no join criterion between these tables, which is wrong.</p>



<p>A better option is to use an INNER JOIN, like in the next example.</p>



<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);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);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">4) ANSI SQL-92 Inner Join</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>select dept.deptno, emp.ename
  from dept join emp on emp.deptno = dept.deptno
 order by dept.deptno, emp.ename;</textarea></pre><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"> dept.deptno, emp.ename</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> dept </span><span style="color: #569CD6">join</span><span style="color: #D4D4D4"> emp </span><span style="color: #569CD6">on</span><span style="color: #D4D4D4"> emp.deptno = dept.deptno</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">order by</span><span style="color: #D4D4D4"> dept.deptno, emp.ename;</span></span></code></pre></div>



<p>We see that the WHERE clause is gone. Why? &#8211;  Because we do not have filter criteria in this query. No WHERE clause, no filter. As simple as that.</p>



<h2 class="wp-block-heading">Outer Joins</h2>



<p>Now let&#8217;s write an outer join with ANSI SQL-89. As I mentioned before, the standard back then only defined INNER JOINs. So, we need to work around it. One way is something like this:</p>



<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);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);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">5) ANSI SQL-89 Outer Join</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>select dept.deptno, emp.ename
  from dept, emp
 where emp.deptno = dept.deptno
union all
select dept.deptno, null
  from dept
 where not exists (
          select 1
            from emp
           where emp.deptno = dept.deptno
       )
 order by deptno, ename;</textarea></pre><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"> dept.deptno, emp.ename</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> dept, emp</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">where</span><span style="color: #D4D4D4"> emp.deptno = dept.deptno</span></span>
<span class="line cbp-line-highlight"><span style="color: #569CD6">union</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">all</span></span>
<span class="line"><span style="color: #569CD6">select</span><span style="color: #D4D4D4"> dept.deptno, </span><span style="color: #569CD6">null</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> dept</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">where</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">not</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">exists</span><span style="color: #D4D4D4"> (</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #569CD6">select</span><span style="color: #D4D4D4"> </span><span style="color: #B5CEA8">1</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> emp</span></span>
<span class="line"><span style="color: #D4D4D4">           </span><span style="color: #569CD6">where</span><span style="color: #D4D4D4"> emp.deptno = dept.deptno</span></span>
<span class="line"><span style="color: #D4D4D4">       )</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">order by</span><span style="color: #D4D4D4"> deptno, ename;</span></span></code></pre></div>



<div class="wp-block-kevinbatdorf-code-block-pro" 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-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>    DEPTNO ENAME 
---------- ------
        10 CLARK 
        10 KING  
        10 MILLER
        20 ADAMS 
        20 FORD  
        20 JONES 
        20 SCOTT 
        20 SMITH 
        30 ALLEN 
        30 BLAKE 
        30 JAMES 
        30 MARTIN
        30 TURNER
        30 WARD  
        40       

15 rows selected. </textarea></pre><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: #D4D4D4">    DEPTNO ENAME </span></span>
<span class="line"><span style="color: #D4D4D4">---------- ------</span></span>
<span class="line"><span style="color: #D4D4D4">        10 CLARK </span></span>
<span class="line"><span style="color: #D4D4D4">        10 KING  </span></span>
<span class="line"><span style="color: #D4D4D4">        10 MILLER</span></span>
<span class="line"><span style="color: #D4D4D4">        20 ADAMS </span></span>
<span class="line"><span style="color: #D4D4D4">        20 FORD  </span></span>
<span class="line"><span style="color: #D4D4D4">        20 JONES </span></span>
<span class="line"><span style="color: #D4D4D4">        20 SCOTT </span></span>
<span class="line"><span style="color: #D4D4D4">        20 SMITH </span></span>
<span class="line"><span style="color: #D4D4D4">        30 ALLEN </span></span>
<span class="line"><span style="color: #D4D4D4">        30 BLAKE </span></span>
<span class="line"><span style="color: #D4D4D4">        30 JAMES </span></span>
<span class="line"><span style="color: #D4D4D4">        30 MARTIN</span></span>
<span class="line"><span style="color: #D4D4D4">        30 TURNER</span></span>
<span class="line"><span style="color: #D4D4D4">        30 WARD  </span></span>
<span class="line"><span style="color: #D4D4D4">        40       </span></span>
<span class="line"><span style="color: #D4D4D4"></span></span>
<span class="line"><span style="color: #D4D4D4">15 rows selected. </span></span></code></pre></div>



<p>Phew, that&#8217;s a lot of work. It&#8217;s no surprise that database vendors came up with proprietary solutions for outer joins. For example:</p>



<ul class="wp-block-list">
<li><code>*=</code> and <code>=*</code> operators in Sybase/SQL Server</li>



<li><code>(+)</code> operator in Db2 and the Oracle Database</li>
</ul>



<p>Let&#8217;s use the Oracle join syntax.</p>



<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);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);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">6) Oracle-style Outer Join</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>select dept.deptno, emp.ename
  from dept, emp
 where emp.deptno (+) = dept.deptno
 order by dept.deptno, emp.ename;</textarea></pre><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"> dept.deptno, emp.ename</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> dept, emp</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">where</span><span style="color: #D4D4D4"> emp.deptno (+) = dept.deptno</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">order by</span><span style="color: #D4D4D4"> dept.deptno, emp.ename;</span></span></code></pre></div>



<p>Much simpler. <code>EMP</code> is outer joined due to the <code>(+)</code> operator.</p>



<p>And here is an ANSI SQL-92 compliant variant:</p>



<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);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);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">7) ANSI SQL-92 Outer Join</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>select dept.deptno, emp.ename
  from dept left join emp on emp.deptno = dept.deptno
 order by dept.deptno, emp.ename;</textarea></pre><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"> dept.deptno, emp.ename</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> dept </span><span style="color: #569CD6">left join</span><span style="color: #D4D4D4"> emp </span><span style="color: #569CD6">on</span><span style="color: #D4D4D4"> emp.deptno = dept.deptno</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">order by</span><span style="color: #D4D4D4"> dept.deptno, emp.ename;</span></span></code></pre></div>



<p>No WHERE clause, no filter. So far, so good.</p>



<h2 class="wp-block-heading">Outer Joins With Additional Filters</h2>



<p>The problem starts as soon as you use outer join queries with filter predicates. Here&#8217;s an example.</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<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);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);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">8a) Outer Join With Filter &#8211; Oracle-style</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>select dept.deptno, emp.ename, emp.hiredate
  from dept, emp
 where emp.deptno (+) = dept.deptno
   and emp.hiredate (+) > date '1981-12-03'
 order by deptno, ename;</textarea></pre><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"> dept.deptno, emp.ename, emp.hiredate</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> dept, emp</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">where</span><span style="color: #D4D4D4"> emp.deptno (+) = dept.deptno</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">   </span><span style="color: #569CD6">and</span><span style="color: #D4D4D4"> emp.hiredate (+) &gt; </span><span style="color: #569CD6">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-12-03&#39;</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">order by</span><span style="color: #D4D4D4"> deptno, ename;</span></span></code></pre></div>



<div class="wp-block-kevinbatdorf-code-block-pro" 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-highlight-color:rgba(234, 191, 191, 0.2);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>    DEPTNO ENAME  HIREDATE  
---------- ------ ----------
        10 MILLER 23.01.1982
        20 ADAMS  23.05.1987
        20 SCOTT  19.04.1987
        30                  
        40                  </textarea></pre><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: #D4D4D4">    DEPTNO ENAME  HIREDATE  </span></span>
<span class="line"><span style="color: #D4D4D4">---------- ------ ----------</span></span>
<span class="line"><span style="color: #D4D4D4">        10 MILLER 23.01.1982</span></span>
<span class="line"><span style="color: #D4D4D4">        20 ADAMS  23.05.1987</span></span>
<span class="line"><span style="color: #D4D4D4">        20 SCOTT  19.04.1987</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">        30                  </span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">        40                  </span></span></code></pre></div>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<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);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);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">8b) Outer Join With Filter &#8211; ANSI SQL-92</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>select dept.deptno, emp.ename, emp.hiredate
  from dept
  left join emp on emp.deptno = dept.deptno
   and emp.hiredate > date '1981-12-03'
 order by deptno, ename;</textarea></pre><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"> dept.deptno, emp.ename, emp.hiredate</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> dept</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">left join</span><span style="color: #D4D4D4"> emp </span><span style="color: #569CD6">on</span><span style="color: #D4D4D4"> emp.deptno = dept.deptno</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">   </span><span style="color: #569CD6">and</span><span style="color: #D4D4D4"> emp.hiredate &gt; </span><span style="color: #569CD6">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-12-03&#39;</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">order by</span><span style="color: #D4D4D4"> deptno, ename;</span></span></code></pre></div>



<div class="wp-block-kevinbatdorf-code-block-pro" 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-highlight-color:rgba(234, 191, 191, 0.2);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>    DEPTNO ENAME  HIREDATE  
---------- ------ ----------
        10 MILLER 23.01.1982
        20 ADAMS  23.05.1987
        20 SCOTT  19.04.1987
        30                  
        40                  </textarea></pre><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: #D4D4D4">    DEPTNO ENAME  HIREDATE  </span></span>
<span class="line"><span style="color: #D4D4D4">---------- ------ ----------</span></span>
<span class="line"><span style="color: #D4D4D4">        10 MILLER 23.01.1982</span></span>
<span class="line"><span style="color: #D4D4D4">        20 ADAMS  23.05.1987</span></span>
<span class="line"><span style="color: #D4D4D4">        20 SCOTT  19.04.1987</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">        30                  </span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">        40                  </span></span></code></pre></div>
</div>
</div>



<p>Both query variants use the predicate <code>emp.hiredate &gt; date '1981-12-03'</code> as part of the outer join criteria. As a result, the DEPT rows 30 and 40 are shown with empty EMP columns. </p>



<p>The result is correct. But is this the result we want?</p>



<p>I don&#8217;t think so. One option is that we don&#8217;t want an outer join at all. Something like this:</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<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);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);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">9a) Inner Join With Filter &#8211; ANSI SQL-89</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>select dept.deptno, emp.ename, emp.hiredate
  from dept, emp
 where emp.deptno = dept.deptno
   and emp.hiredate > date '1981-12-03'
 order by deptno, ename;</textarea></pre><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"> dept.deptno, emp.ename, emp.hiredate</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> dept, emp</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">where</span><span style="color: #D4D4D4"> emp.deptno = dept.deptno</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">   </span><span style="color: #569CD6">and</span><span style="color: #D4D4D4"> emp.hiredate &gt; </span><span style="color: #569CD6">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-12-03&#39;</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">order by</span><span style="color: #D4D4D4"> deptno, ename;</span></span></code></pre></div>



<div class="wp-block-kevinbatdorf-code-block-pro" 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;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>    DEPTNO ENAME  HIREDATE  
---------- ------ ----------
        10 MILLER 23.01.1982
        20 ADAMS  23.05.1987
        20 SCOTT  19.04.1987</textarea></pre><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: #D4D4D4">    DEPTNO ENAME  HIREDATE  </span></span>
<span class="line"><span style="color: #D4D4D4">---------- ------ ----------</span></span>
<span class="line"><span style="color: #D4D4D4">        10 MILLER 23.01.1982</span></span>
<span class="line"><span style="color: #D4D4D4">        20 ADAMS  23.05.1987</span></span>
<span class="line"><span style="color: #D4D4D4">        20 SCOTT  19.04.1987</span></span></code></pre></div>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<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);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);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">9b) Inner Join With Filter &#8211; ANSI SQL-92</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>select dept.deptno, emp.ename, emp.hiredate
  from dept
  join emp on emp.deptno = dept.deptno
 where emp.hiredate > date '1981-12-03'
 order by deptno, ename;</textarea></pre><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"> dept.deptno, emp.ename, emp.hiredate</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> dept</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">join</span><span style="color: #D4D4D4"> emp </span><span style="color: #569CD6">on</span><span style="color: #D4D4D4"> emp.deptno = dept.deptno</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">where</span><span style="color: #D4D4D4"> emp.hiredate &gt; </span><span style="color: #569CD6">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-12-03&#39;</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">order by</span><span style="color: #D4D4D4"> deptno, ename;</span></span></code></pre></div>



<div class="wp-block-kevinbatdorf-code-block-pro" 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;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>    DEPTNO ENAME  HIREDATE  
---------- ------ ----------
        10 MILLER 23.01.1982
        20 ADAMS  23.05.1987
        20 SCOTT  19.04.1987</textarea></pre><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: #D4D4D4">    DEPTNO ENAME  HIREDATE  </span></span>
<span class="line"><span style="color: #D4D4D4">---------- ------ ----------</span></span>
<span class="line"><span style="color: #D4D4D4">        10 MILLER 23.01.1982</span></span>
<span class="line"><span style="color: #D4D4D4">        20 ADAMS  23.05.1987</span></span>
<span class="line"><span style="color: #D4D4D4">        20 SCOTT  19.04.1987</span></span></code></pre></div>
</div>
</div>



<p>Now we use the predicate <code>emp.hiredate &gt; date '1981-12-03'</code> as a filter criterion. It&#8217;s applied after the join. The result would be the same if we used a LEFT JOIN in 9b).</p>



<p>In most cases, join criteria are based only on the foreign key-primary key relationships. If I see something else, I typically need to dig deeper to understand what the requirements of the query are.</p>



<p>So, maybe we want to see only the employees that match the filter, including departments that have no employees. For that, we could rewrite the query as follows:</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<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);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);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">10a) Outer Join With Filter &#8211; Oracle-style</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>select dept.deptno, emp.ename, emp.hiredate
  from dept, emp
 where emp.deptno (+) = dept.deptno
   and (emp.hiredate > date '1981-12-03' or emp.deptno is null)
 order by deptno, ename;</textarea></pre><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"> dept.deptno, emp.ename, emp.hiredate</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> dept, emp</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">where</span><span style="color: #D4D4D4"> emp.deptno (+) = dept.deptno</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">   </span><span style="color: #569CD6">and</span><span style="color: #D4D4D4"> (emp.hiredate &gt; </span><span style="color: #569CD6">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-12-03&#39;</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">or</span><span style="color: #D4D4D4"> emp.deptno </span><span style="color: #569CD6">is null</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">order by</span><span style="color: #D4D4D4"> deptno, ename;</span></span></code></pre></div>



<div class="wp-block-kevinbatdorf-code-block-pro" 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;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>    DEPTNO ENAME  HIREDATE  
---------- ------ ----------
        10 MILLER 23.01.1982
        20 ADAMS  23.05.1987
        20 SCOTT  19.04.1987
        40                  </textarea></pre><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: #D4D4D4">    DEPTNO ENAME  HIREDATE  </span></span>
<span class="line"><span style="color: #D4D4D4">---------- ------ ----------</span></span>
<span class="line"><span style="color: #D4D4D4">        10 MILLER 23.01.1982</span></span>
<span class="line"><span style="color: #D4D4D4">        20 ADAMS  23.05.1987</span></span>
<span class="line"><span style="color: #D4D4D4">        20 SCOTT  19.04.1987</span></span>
<span class="line"><span style="color: #D4D4D4">        40                  </span></span></code></pre></div>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<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);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);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">10b) Outer Join With Filter &#8211; ANSI SQL-92</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>select dept.deptno, emp.ename, emp.hiredate
  from dept left join emp
    on emp.deptno = dept.deptno
 where (emp.hiredate > date '1981-12-03' or emp.deptno is null)
 order by deptno, ename;</textarea></pre><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"> dept.deptno, emp.ename, emp.hiredate</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> dept </span><span style="color: #569CD6">left join</span><span style="color: #D4D4D4"> emp</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #569CD6">on</span><span style="color: #D4D4D4"> emp.deptno = dept.deptno</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">where</span><span style="color: #D4D4D4"> (emp.hiredate &gt; </span><span style="color: #569CD6">date</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1981-12-03&#39;</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">or</span><span style="color: #D4D4D4"> emp.deptno </span><span style="color: #569CD6">is null</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">order by</span><span style="color: #D4D4D4"> deptno, ename;</span></span></code></pre></div>



<div class="wp-block-kevinbatdorf-code-block-pro" 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;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>    DEPTNO ENAME  HIREDATE  
---------- ------ ----------
        10 MILLER 23.01.1982
        20 ADAMS  23.05.1987
        20 SCOTT  19.04.1987
        40                  </textarea></pre><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: #D4D4D4">    DEPTNO ENAME  HIREDATE  </span></span>
<span class="line"><span style="color: #D4D4D4">---------- ------ ----------</span></span>
<span class="line"><span style="color: #D4D4D4">        10 MILLER 23.01.1982</span></span>
<span class="line"><span style="color: #D4D4D4">        20 ADAMS  23.05.1987</span></span>
<span class="line"><span style="color: #D4D4D4">        20 SCOTT  19.04.1987</span></span>
<span class="line"><span style="color: #D4D4D4">        40                  </span></span></code></pre></div>
</div>
</div>



<p>This example shows why it&#8217;s important to distinguish between join criteria and filter criteria. The ANSI SQL-92 syntax makes this easier. Unfortunately, there are still a few bugs and limitations when using ANSI-92 syntax in every Oracle Database version. But there are fewer and fewer of these problems with each new version. </p>



<p>Therefore, I use the ANSI SQL-92 join syntax whenever possible and try to document the reason when I cannot. </p>



<h2 class="wp-block-heading">Use dbLinter to Change Queries to ANSI SQL-92 Join Syntax</h2>



<p><a href="https://marketplace.visualstudio.com/items?itemName=Grisselbav.dblinter">dbLinter</a> can find queries that do not use ANSI SQL-92 join syntax. Simply put, it searches for multiple items in the FROM clause. It also provides a quick fix to convert ANSI SQL-89 and Oracle-style joins to ANSI SQL-92 syntax. Here&#8217;s a screenshot with the previously discussed queries:</p>



<figure class="wp-block-image size-large is-resized"><a href="https://www.salvis.com/blog/wp-content/uploads/2025/07/image-10.png"><img loading="lazy" decoding="async" width="1024" height="845" src="https://www.salvis.com/blog/wp-content/uploads/2025/07/image-10-1024x845.png" alt="dbLinter for VS Code showing G-3130 violations and the pop-up window to apply quick fixes" class="wp-image-13999" style="width:820px" srcset="https://www.salvis.com/blog/wp-content/uploads/2025/07/image-10-1024x845.png 1024w, https://www.salvis.com/blog/wp-content/uploads/2025/07/image-10-300x248.png 300w, https://www.salvis.com/blog/wp-content/uploads/2025/07/image-10-768x634.png 768w, https://www.salvis.com/blog/wp-content/uploads/2025/07/image-10-1536x1268.png 1536w, https://www.salvis.com/blog/wp-content/uploads/2025/07/image-10-91x75.png 91w, https://www.salvis.com/blog/wp-content/uploads/2025/07/image-10-480x396.png 480w, https://www.salvis.com/blog/wp-content/uploads/2025/07/image-10.png 1640w" sizes="auto, (max-width:767px) 480px, (max-width:1024px) 100vw, 1024px" /></a></figure>



<p>After applying the quick fix to all <a href="https://dblinter-rules.united-codes.com/rules/G-3130/">G-3130</a> violations in the file, the result looks like this:</p>



<figure class="wp-block-image size-large is-resized"><a href="https://www.salvis.com/blog/wp-content/uploads/2025/07/image-9.png"><img loading="lazy" decoding="async" width="1024" height="768" src="https://www.salvis.com/blog/wp-content/uploads/2025/07/image-9-1024x768.png" alt="dbLinter for VS Code after applying the quick fix for all G-3130 violations" class="wp-image-13998" style="width:640px" srcset="https://www.salvis.com/blog/wp-content/uploads/2025/07/image-9-1024x768.png 1024w, https://www.salvis.com/blog/wp-content/uploads/2025/07/image-9-300x225.png 300w, https://www.salvis.com/blog/wp-content/uploads/2025/07/image-9-768x576.png 768w, https://www.salvis.com/blog/wp-content/uploads/2025/07/image-9-100x75.png 100w, https://www.salvis.com/blog/wp-content/uploads/2025/07/image-9-480x360.png 480w, https://www.salvis.com/blog/wp-content/uploads/2025/07/image-9.png 1280w" sizes="auto, (max-width:767px) 480px, (max-width:1024px) 100vw, 1024px" /></a></figure>



<p>The result looks quite good, except that the predicate in the 8a) example is not moved to the join condition (see red arrow in the screenshot above). Why is that the case? &#8211; The quick fix only moves equality predicates and predicates that are not part of a Boolean OR condition to the join condition. If there are leftover outer join operators <code>(+)</code> in the WHERE clause, they are surrounded by a TODO comment.</p>



<p>To get started with <a href="https://marketplace.visualstudio.com/items?itemName=Grisselbav.dblinter">dbLinter</a>, I recommend <a href="https://youtu.be/V-ePBfUFhhk">watching Philipp Harenfeller&#8217;s video</a>. United Codes and Grisselbav are collaborating on this product.</p>



<p>Feedback is very much appreciated. Comment on this blog post or raise an issue on the <a href="https://github.com/Grisselbav/dbLinter">dbLinter GitHub repository</a>.</p>



<p>Thanks.</p>



<p></p>
<p>The post <a href="https://www.salvis.com/blog/2025/07/12/outer-joining-with-ansi-sql-89-and-sql-92/">Outer Joining With ANSI SQL-89 and SQL-92</a> appeared first on <a href="https://www.salvis.com/blog">Philipp Salvisberg&#039;s Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>dbLinter Rules Repository</title>
		<link>https://www.salvis.com/blog/2025/03/18/dblinter-rules-repository/</link>
		
		<dc:creator><![CDATA[Philipp Salvisberg]]></dc:creator>
		<pubDate>Tue, 18 Mar 2025 20:31:42 +0000</pubDate>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Code Analysis]]></category>
		<category><![CDATA[dbLinter]]></category>
		<category><![CDATA[PL/SQL]]></category>
		<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">https://www.salvis.com/blog/?p=13856</guid>

					<description><![CDATA[<p>Introduction Today I proudly announce that the Joint Venture between United Codes and Grisselbav released the initial version of the dbLinter Rules Repository website. This is the first publicly available component of the dbLinter tool suite. What is dbLinter? dbLinter is a suite for checking and improving the quality of database applications.<span class="excerpt-hellip"> […]</span></p>
<p>The post <a href="https://www.salvis.com/blog/2025/03/18/dblinter-rules-repository/">dbLinter Rules Repository</a> appeared first on <a href="https://www.salvis.com/blog">Philipp Salvisberg&#039;s Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Introduction</h2>



<p>Today I proudly announce that the Joint Venture between <a href="https://blog.united-codes.com/post/announcing-dblinter">United Codes </a>and <a href="https://www.grisselbav.com/">Grisselbav</a> released the initial version of the <a href="https://dblinter-rules.united-codes.com/">dbLinter Rules Repository website</a>. This is the first publicly available component of the dbLinter tool suite.</p>



<h2 class="wp-block-heading">What is dbLinter?</h2>



<p>dbLinter is a suite for checking and improving the quality of database applications. Quality is assessed using static code analysis and database queries based on a configuration. A configuration is primarily centrally managed. It contains file patterns, rules, validators, SQL-based tests, parameters, and connect information for read-only database access within checks and tests.</p>



<h2 class="wp-block-heading">Is it Free?</h2>



<p>dbLinter is a commercial and subscription-based product. However, there are two free subscription plans foreseen. <strong>Anonymous</strong> without registration and <strong>Free</strong> requiring registration with a valid email address. You need a login to manage configurations.</p>


<div class="wp-block-tableberg-wrapper is-style-regular wp-block-tableberg-table" >
			<div class="tableberg-table-wrapper" style="">
				<table class = "has-inner-border" style="border-spacing: 0 0; --tableberg-inner-border-top: none; --tableberg-inner-border-right: 1px solid #000000; --tableberg-inner-border-bottom: 1px solid #000000; --tableberg-inner-border-left: none; --tableberg-inner-border-top-first: 1px solid #000000; --tableberg-inner-border-left-first: 1px solid #000000; " data-tableberg-header="converted" data-tableberg-footer=""  ><colgroup><col style=""/><col style="width: 10%; min-width: 10%; "/><col style="width: 10%; min-width: 10%; "/><col style="width: 10%; min-width: 10%; "/><col style="width: 10%; min-width: 10%; "/></colgroup><tbody><tr class="tableberg-header" style="">
<th data-tableberg-row="0" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left"></p>
</div></th>

<th data-tableberg-row="0" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">Anonymous</p>
</div></th>

<th data-tableberg-row="0" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p>Free</p>
</div></th>

<th data-tableberg-row="0" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p>Essential</p>
</div></th>

<th data-tableberg-row="0" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p>Professional</p>
</div></th>
</tr><tr class="tableberg-odd-row" style="">
<td data-tableberg-row="1" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Number of seats</p>
</div></td>

<td data-tableberg-row="1" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">unlimited</p>
</div></td>

<td data-tableberg-row="1" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">1</p>
</div></td>

<td data-tableberg-row="1" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">1-n</p>
</div></td>

<td data-tableberg-row="1" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">1-n</p>
</div></td>
</tr><tr class="tableberg-even-row" style="">
<td data-tableberg-row="2" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Number of configurations</p>
</div></td>

<td data-tableberg-row="2" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="2" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">1</p>
</div></td>

<td data-tableberg-row="2" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">unlimited</p>
</div></td>

<td data-tableberg-row="2" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">unlimited</p>
</div></td>
</tr><tr class="tableberg-odd-row" style="">
<td data-tableberg-row="3" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">View rules and related data</p>
</div></td>

<td data-tableberg-row="3" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="3" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="3" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="3" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-even-row" style="">
<td data-tableberg-row="4" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Manage configurations</p>
</div></td>

<td data-tableberg-row="4" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="4" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="4" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="4" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-odd-row" style="">
<td data-tableberg-row="5" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Run checks</p>
</div></td>

<td data-tableberg-row="5" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="5" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="5" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="5" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-even-row" style="">
<td data-tableberg-row="6" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Run SQL-based tests</p>
</div></td>

<td data-tableberg-row="6" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="6" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="6" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="6" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-odd-row" style="">
<td data-tableberg-row="7" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">dbLinter VS Code extension</p>
</div></td>

<td data-tableberg-row="7" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="7" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="7" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="7" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-even-row" style="">
<td data-tableberg-row="8" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Run all accessible checks and tests</p>
</div></td>

<td data-tableberg-row="8" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="8" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="8" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="8" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-odd-row" style="">
<td data-tableberg-row="9" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Quick fixes in dbLinter VS Code extension</p>
</div></td>

<td data-tableberg-row="9" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="9" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="9" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="9" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-even-row" style="">
<td data-tableberg-row="10" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Ignore chosen SQL-based test findings</p>
</div></td>

<td data-tableberg-row="10" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="10" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="10" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="10" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-odd-row" style="">
<td data-tableberg-row="11" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">dbLinter CLI with SonarCloud integration</p>
</div></td>

<td data-tableberg-row="11" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="11" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="11" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="11" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-even-row" style="">
<td data-tableberg-row="12" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Manage user access</p>
</div></td>

<td data-tableberg-row="12" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="12" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="12" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>

<td data-tableberg-row="12" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-odd-row" style="">
<td data-tableberg-row="13" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">dbLinter SonarQube plugin</p>
</div></td>

<td data-tableberg-row="13" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="13" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="13" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="13" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-even-row" style="">
<td data-tableberg-row="14" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Access to dbLinter test repository</p>
</div></td>

<td data-tableberg-row="14" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="14" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="14" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="14" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-odd-row" style="">
<td data-tableberg-row="15" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Custom rules, checks and SQL-based tests</p>
</div></td>

<td data-tableberg-row="15" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="15" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="15" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="15" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-even-row" style="">
<td data-tableberg-row="16" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Generate Java project for checks and SQL-based tests</p>
</div></td>

<td data-tableberg-row="16" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="16" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="16" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="16" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-odd-row" style="">
<td data-tableberg-row="17" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Manage custom validators (plugins)</p>
</div></td>

<td data-tableberg-row="17" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="17" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="17" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="17" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-even-row" style="">
<td data-tableberg-row="18" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Export rules and configurations</p>
</div></td>

<td data-tableberg-row="18" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="18" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="18" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="18" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr><tr class="tableberg-odd-row" style="">
<td data-tableberg-row="19" data-tableberg-col="0" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-left">Import rules and configurations</p>
</div></td>

<td data-tableberg-row="19" data-tableberg-col="1" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="19" data-tableberg-col="2" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="19" data-tableberg-col="3" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">&#8211;</p>
</div></td>

<td data-tableberg-row="19" data-tableberg-col="4" style="" class="wp-block-tableberg-cell tableberg-v-align-center"><div class="tableberg-cell-inner" style="display: block; justify-content: center; flex-wrap: wrap; ">
<p class="has-text-align-center">yes</p>
</div></td>
</tr></tbody></table>
			</div>
		</div>


<p>And of course, access to the <a href="https://dblinter-rules.united-codes.com/">dbLinter Rules Repository website</a> is also free.</p>



<h2 class="wp-block-heading">What Are the Rules Based on?</h2>



<p>Most of the rules are taken over from the decommissioned <a href="https://trivadis.github.io/plsql-and-sql-coding-guidelines/v4.4/">Trivadis PL/SQL &amp; SQL Coding Guidelines</a>. The origin is documented per rule under the <code>Reference</code> section. See for example <a href="https://dblinter-rules.united-codes.com/rules/G-1080/">G-1080: Avoid using the same expression on both sides of a relational comparison operator or a logical operator</a>. This rule exists in 4 different rule repositories.</p>



<h2 class="wp-block-heading">Over 180 Rules &#8211; This is Ridiculous!</h2>



<p>You do not need to enable all rules. I compare it to a breakfast buffet. You pick what you like and how much you want.</p>



<p>Furthermore, not all rules have the same severity. The most important rules are marked as <a href="https://dblinter-rules.united-codes.com/severity-levels/blocker/">Blocker</a>. Pick some of these to start with.</p>



<h2 class="wp-block-heading">What&#8217;s Next?</h2>



<p>Coding guidelines are really helpful, especially if you can use them to review your code automatically while it&#8217;s being developed in your favourite IDE. Of course you want them also as part of a CI/CD pipeline. However, finding problems while typing code is far more efficient.</p>



<p>Therefore the next component will be a VS Code extension. Here&#8217;s an example of how it will look like:</p>



<figure class="wp-block-video"><video height="900" style="aspect-ratio: 1200 / 900;" width="1200" autoplay controls loop muted src="https://www.salvis.com/blog/wp-content/uploads/2025/03/sneak-peak-dblinter1.mp4" playsinline></video></figure>



<p>Stay tuned.</p>



<p></p>
<p>The post <a href="https://www.salvis.com/blog/2025/03/18/dblinter-rules-repository/">dbLinter Rules Repository</a> appeared first on <a href="https://www.salvis.com/blog">Philipp Salvisberg&#039;s Blog</a>.</p>
]]></content:encoded>
					
		
		<enclosure url="https://www.salvis.com/blog/wp-content/uploads/2025/03/sneak-peak-dblinter1.mp4" length="2152245" type="video/mp4" />

			</item>
	</channel>
</rss>
