<?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>SQLcl Archives - Philipp Salvisberg&#039;s Blog</title>
	<atom:link href="https://www.salvis.com/blog/tag/sqlcl/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.salvis.com/blog/tag/sqlcl/</link>
	<description>Database-centric development</description>
	<lastBuildDate>Mon, 27 Jul 2026 09:17:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>

<image>
	<url>https://www.salvis.com/blog/wp-content/uploads/2014/04/favicon.png</url>
	<title>SQLcl Archives - Philipp Salvisberg&#039;s Blog</title>
	<link>https://www.salvis.com/blog/tag/sqlcl/</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/sqlcl/feed/"/>
	<item>
		<title>The Return of SQLcl&#8217;s SCRIPT Command</title>
		<link>https://www.salvis.com/blog/2026/07/25/the-return-of-sqlcls-script-command/</link>
					<comments>https://www.salvis.com/blog/2026/07/25/the-return-of-sqlcls-script-command/#comments</comments>
		
		<dc:creator><![CDATA[Philipp Salvisberg]]></dc:creator>
		<pubDate>Sat, 25 Jul 2026 14:02:15 +0000</pubDate>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[SQL Developer]]></category>
		<category><![CDATA[SQLcl]]></category>
		<guid isPermaLink="false">https://www.salvis.com/blog/?p=21049</guid>

					<description><![CDATA[<p>Introduction The script command was introduced with SQLcl 4.2. It is based on JSR 223, the Java Scripting API, and makes it possible to run JavaScript from SQLcl. This adds client-side control flow, file access, better control of host commands and access to Java classes and JavaScript libraries. JDK 8 was the<span class="excerpt-hellip"> […]</span></p>
<p>The post <a href="https://www.salvis.com/blog/2026/07/25/the-return-of-sqlcls-script-command/">The Return of SQLcl&#8217;s SCRIPT Command</a> appeared first on <a href="https://www.salvis.com/blog">Philipp Salvisberg&#039;s Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 id="introduction" class="wp-block-heading">Introduction</h2>



<p class="wp-block-paragraph">The <code>script</code> command was introduced with SQLcl 4.2. It is based on JSR 223, the Java Scripting API, and makes it possible to run JavaScript from SQLcl. This adds client-side control flow, file access, better control of host commands and access to Java classes and JavaScript libraries. </p>



<p class="wp-block-paragraph">JDK 8 was the latest and greatest back in 2015 when Kris Rice promoted this feature on his <a href="https://krisrice.io/2015-10-13-sqlcl-oct-13th-edition/" target="_blank" rel="noreferrer noopener">blog</a>. The <code>script</code> command worked out of the box because JDK 8 included the Nashorn JavaScript engine. Nashorn was deprecated in JDK 11 and removed in JDK 15, but continues as a <a href="https://github.com/openjdk/nashorn" data-type="link" data-id="https://github.com/openjdk/nashorn" target="_blank" rel="noreferrer noopener">standalone OpenJDK library</a> for JDK 11 and newer. The current version 26.2 of SQLcl requires JDK 11 or newer, but does not include a JavaScript engine. Therefore, <code>script</code> no longer works with a modern standard JDK.</p>



<p class="wp-block-paragraph">The <a href="https://docs.oracle.com/en/database/oracle/sql-developer-command-line/26.2/sqcug/working-sqlcl.html" target="_blank" rel="noreferrer noopener">documented solution</a> is to use GraalVM and install its JavaScript engine using the command <code>gu install js</code>. However, <code>gu</code> has been removed from more recent GraalVM distributions. Applications requiring a JavaScript engine must therefore provide the necessary Maven dependencies themselves.</p>



<p class="wp-block-paragraph">Furthermore, the SQL Developer extension for VS Code comes with its own JDK 25. We cannot simply replace it with an older GraalVM JDK since some components require a JDK 25 and are therefore incompatible with older JDK versions.</p>



<p class="wp-block-paragraph">The <code>script</code> command does not work in SQLcl embedded in SQL Developer for VS Code.</p>



<p class="wp-block-paragraph">Let’s change that.</p>



<h2 id="patching-sqlcl-in-sql-developer-for-vs-code" class="wp-block-heading">Patching SQLcl in SQL Developer for VS Code</h2>



<p class="wp-block-paragraph">I experimented with various approaches. The result is <a href="https://github.com/PhilippSalvisberg/sqlcl-js-patch/blob/main/sqlcl-js-patch.sh" data-type="link" data-id="https://github.com/PhilippSalvisberg/sqlcl-js-patch" target="_blank" rel="noreferrer noopener">sqlcl-js-patch.sh</a>. The idea is to download the missing JavaScript engine and its dependencies from Maven Central and add them to an SQLcl installation. This shell script supports GraalJS and Nashorn on JDK 17 and newer.</p>



<p class="wp-block-paragraph">For SQL Developer for VS Code, I prefer Nashorn. It is compatible with the behaviour we had with JDK 8 and JDK 11 and produces no warnings when SQLcl starts.</p>



<p class="wp-block-paragraph">Close all SQLcl sessions in VS Code. Then run the following command in a macOS, Linux or Git Bash shell:</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">1) Patch SQLcl with Nashorn JavaScript engine</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>curl --fail --location --silent --show-error \
  https://raw.githubusercontent.com/PhilippSalvisberg/sqlcl-js-patch/refs/heads/main/sqlcl-js-patch.sh |
  sh -s -- add nashorn "sqlcl_home=$HOME/.vscode"</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: #DCDCAA">curl</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--fail</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--location</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--silent</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--show-error</span><span style="color: #D4D4D4"> </span><span style="color: #D7BA7D">\</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #CE9178">https://raw.githubusercontent.com/PhilippSalvisberg/sqlcl-js-patch/refs/heads/main/sqlcl-js-patch.sh</span><span style="color: #D4D4D4"> |</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">sh</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">-s</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">add</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">nashorn</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;sqlcl_home=</span><span style="color: #9CDCFE">$HOME</span><span style="color: #CE9178">/.vscode&quot;</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>Downloading nashorn-core-15.7.jar
Downloading asm-7.3.1.jar
Downloading asm-commons-7.3.1.jar
Downloading asm-analysis-7.3.1.jar
Downloading asm-tree-7.3.1.jar
Downloading asm-util-7.3.1.jar
No matching libraries found in /Users/phs/.vscode/extensions/oracle.sql-developer-26.2.0-darwin-arm64/dbtools/sqlcl/lib.
Installed nashorn-core-15.7.jar
Installed asm-commons-7.3.1.jar
Installed asm-7.3.1.jar
Installed asm-analysis-7.3.1.jar
Installed asm-util-7.3.1.jar
Installed asm-tree-7.3.1.jar
No nashorn.args VM option found in macOS/Linux launcher; skipped Nashorn launcher patch.
Installed nashorn libraries in /Users/phs/.vscode/extensions/oracle.sql-developer-26.2.0-darwin-arm64/dbtools/sqlcl/lib.</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">Downloading nashorn-core-15.7.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading asm-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading asm-commons-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading asm-analysis-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading asm-tree-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading asm-util-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">No matching libraries found in /Users/phs/.vscode/extensions/oracle.sql-developer-26.2.0-darwin-arm64/dbtools/sqlcl/lib.</span></span>
<span class="line"><span style="color: #D4D4D4">Installed nashorn-core-15.7.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed asm-commons-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed asm-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed asm-analysis-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed asm-util-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed asm-tree-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">No nashorn.args VM option found in macOS/Linux launcher; skipped Nashorn launcher patch.</span></span>
<span class="line"><span style="color: #D4D4D4">Installed nashorn libraries in /Users/phs/.vscode/extensions/oracle.sql-developer-26.2.0-darwin-arm64/dbtools/sqlcl/lib.</span></span></code></pre></div>



<p class="wp-block-paragraph">The patch script locates the most recent Oracle SQL Developer extension in the <code>$HOME/.vscode/extensions</code> directory. It adds the necessary JAR files to the embedded SQLcl, whose directory structure differs from that of standalone SQLcl.</p>



<p class="wp-block-paragraph">Now start a new SQLcl session in VS Code and run:</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">2) Test script command</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>script
print('Hello from Nashorn');
/</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">script</span></span>
<span class="line"><span style="color: #DCDCAA">print</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&#39;Hello from Nashorn&#39;</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><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(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 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>SQLcl: Release 26.2 Production on Sat Jul 25 13:19:46 2026

Copyright (c) 1982, 2026, Oracle.  All rights reserved.

Connected to:
Oracle AI Database 26ai Free Release 23.26.2.0.0 - Develop, Learn, and Run for Free
Version 23.26.2.0.0

Hello from Nashorn
SQL> </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">SQLcl: Release 26.2 Production on Sat Jul 25 13:19:46 2026</span></span>
<span class="line"><span style="color: #D4D4D4"></span></span>
<span class="line"><span style="color: #D4D4D4">Copyright (c) 1982, 2026, Oracle.  All rights reserved.</span></span>
<span class="line"><span style="color: #D4D4D4"></span></span>
<span class="line"><span style="color: #D4D4D4">Connected to:</span></span>
<span class="line"><span style="color: #D4D4D4">Oracle AI Database 26ai Free Release 23.26.2.0.0 - Develop, Learn, and Run for Free</span></span>
<span class="line"><span style="color: #D4D4D4">Version 23.26.2.0.0</span></span>
<span class="line"><span style="color: #D4D4D4"></span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">Hello from Nashorn</span></span>
<span class="line"><span style="color: #D4D4D4">SQL&gt; </span></span></code></pre></div>



<p class="wp-block-paragraph">This does not work when the code is executed directly in a SQL Developer worksheet. It works when you select <strong>Run in SQLcl</strong>.</p>



<p class="wp-block-paragraph">That’s it. The <code>script</code> command is back.</p>



<p class="wp-block-paragraph">Please note that updating the SQL Developer extension installs a new embedded SQLcl. In that case, run the patch command again.</p>



<h2 id="does-it-work-with-graaljs" class="wp-block-heading">Does It Work With GraalJS?</h2>



<p class="wp-block-paragraph">Yes. </p>



<p class="wp-block-paragraph">Just pass <code>graaljs</code> instead of <code>nashorn</code>:</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) Patch SQLcl with GraalJS JavaScript engine</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>curl --fail --location --silent --show-error \
  https://raw.githubusercontent.com/PhilippSalvisberg/sqlcl-js-patch/refs/heads/main/sqlcl-js-patch.sh |
  sh -s -- add graaljs "sqlcl_home=$HOME/.vscode"</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: #DCDCAA">curl</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--fail</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--location</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--silent</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--show-error</span><span style="color: #D4D4D4"> </span><span style="color: #D7BA7D">\</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #CE9178">https://raw.githubusercontent.com/PhilippSalvisberg/sqlcl-js-patch/refs/heads/main/sqlcl-js-patch.sh</span><span style="color: #D4D4D4"> |</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">sh</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">-s</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">add</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">graaljs</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;sqlcl_home=</span><span style="color: #9CDCFE">$HOME</span><span style="color: #CE9178">/.vscode&quot;</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>Downloading collections-25.1.3.jar
Downloading icu4j-25.1.3.jar
Downloading jniutils-25.1.3.jar
Downloading js-language-25.1.3.jar
Downloading js-scriptengine-25.1.3.jar
Downloading nativeimage-25.1.3.jar
Downloading polyglot-25.1.3.jar
Downloading regex-25.1.3.jar
Downloading truffle-api-25.1.3.jar
Downloading truffle-compiler-25.1.3.jar
Downloading truffle-runtime-25.1.3.jar
Downloading word-25.1.3.jar
Downloading xz-25.1.3.jar
Deleted nashorn-core-15.7.jar
Deleted asm-commons-7.3.1.jar
Deleted asm-7.3.1.jar
Deleted asm-analysis-7.3.1.jar
Deleted asm-util-7.3.1.jar
Deleted asm-tree-7.3.1.jar
Deleted asm-commons-7.3.1.jar
Deleted asm-analysis-7.3.1.jar
Deleted asm-tree-7.3.1.jar
Deleted asm-util-7.3.1.jar
Installed collections-25.1.3.jar
Installed regex-25.1.3.jar
Installed truffle-compiler-25.1.3.jar
Installed polyglot-25.1.3.jar
Installed truffle-api-25.1.3.jar
Installed jniutils-25.1.3.jar
Installed truffle-runtime-25.1.3.jar
Installed js-language-25.1.3.jar
Installed xz-25.1.3.jar
Installed word-25.1.3.jar
Installed icu4j-25.1.3.jar
Installed js-scriptengine-25.1.3.jar
Installed nativeimage-25.1.3.jar
Installed graaljs libraries in /Users/phs/.vscode/extensions/oracle.sql-developer-26.2.0-darwin-arm64/dbtools/sqlcl/lib.</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">Downloading collections-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading icu4j-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading jniutils-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading js-language-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading js-scriptengine-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading nativeimage-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading polyglot-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading regex-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading truffle-api-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading truffle-compiler-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading truffle-runtime-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading word-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Downloading xz-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Deleted nashorn-core-15.7.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Deleted asm-commons-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Deleted asm-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Deleted asm-analysis-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Deleted asm-util-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Deleted asm-tree-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Deleted asm-commons-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Deleted asm-analysis-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Deleted asm-tree-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Deleted asm-util-7.3.1.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed collections-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed regex-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed truffle-compiler-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed polyglot-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed truffle-api-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed jniutils-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed truffle-runtime-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed js-language-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed xz-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed word-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed icu4j-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed js-scriptengine-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed nativeimage-25.1.3.jar</span></span>
<span class="line"><span style="color: #D4D4D4">Installed graaljs libraries in /Users/phs/.vscode/extensions/oracle.sql-developer-26.2.0-darwin-arm64/dbtools/sqlcl/lib.</span></span></code></pre></div>



<p class="wp-block-paragraph">Let&#8217;s start a new SQLcl session in VS Code and run:</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">4) Test script command</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>script
print('Hello from GraalJS');
/</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">script</span></span>
<span class="line"><span style="color: #DCDCAA">print</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&#39;Hello from GraalJS&#39;</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">/</span></span></code></pre></div>



<details class="wp-block-details is-layout-flow wp-block-details-is-layout-flow"><summary>Show/hide output</summary>
<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>SQLcl: Release 26.2 Production on Sat Jul 25 12:20:22 2026

Copyright (c) 1982, 2026, Oracle.  All rights reserved.

WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by com.oracle.truffle.polyglot.JDKSupport in module org.graalvm.truffle (file:/Users/phs/.vscode/extensions/oracle.sql-developer-26.2.0-darwin-arm64/dbtools/sqlcl/lib/truffle-api-25.1.3.jar)
WARNING: Use --enable-native-access=org.graalvm.truffle to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled

&#91;To redirect Truffle log output to a file use one of the following options:
* '--log.file=&lt;path>' if the option is passed using a guest language launcher.
* '-Dpolyglot.log.file=&lt;path>' if the option is passed using the host Java launcher.
* Configure logging using the polyglot embedding API.&#93;
&#91;engine&#93; WARNING: The polyglot engine uses a fallback runtime that does not support runtime compilation to native code.
Execution without runtime compilation will negatively impact the guest application performance.
The following cause was found: JVMCI is not enabled for this JVM. Enable JVMCI using -XX:+EnableJVMCI.
For more information see: https://www.graalvm.org/latest/reference-manual/embed-languages/#runtime-optimization-support.
To disable this warning use the '--engine.WarnInterpreterOnly=false' option or the '-Dpolyglot.engine.WarnInterpreterOnly=false' system property.
&#91;To redirect Truffle log output to a file use one of the following options:
* '--log.file=&lt;path>' if the option is passed using a guest language launcher.
* '-Dpolyglot.log.file=&lt;path>' if the option is passed using the host Java launcher.
* Configure logging using the polyglot embedding API.&#93;
&#91;engine&#93; WARNING: The polyglot engine uses a fallback runtime that does not support runtime compilation to native code.
Execution without runtime compilation will negatively impact the guest application performance.
The following cause was found: JVMCI is not enabled for this JVM. Enable JVMCI using -XX:+EnableJVMCI.
For more information see: https://www.graalvm.org/latest/reference-manual/embed-languages/#runtime-optimization-support.
To disable this warning use the '--engine.WarnInterpreterOnly=false' option or the '-Dpolyglot.engine.WarnInterpreterOnly=false' system property.
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.oracle.truffle.api.strings.TStringUnsafe (file:/Users/phs/.vscode/extensions/oracle.sql-developer-26.2.0-darwin-arm64/dbtools/sqlcl/lib/truffle-api-25.1.3.jar)
WARNING: Please consider reporting this to the maintainers of class com.oracle.truffle.api.strings.TStringUnsafe
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
&#91;To redirect Truffle log output to a file use one of the following options:
* '--log.file=&lt;path>' if the option is passed using a guest language launcher.
* '-Dpolyglot.log.file=&lt;path>' if the option is passed using the host Java launcher.
* Configure logging using the polyglot embedding API.&#93;
&#91;engine&#93; WARNING: The polyglot engine uses a fallback runtime that does not support runtime compilation to native code.
Execution without runtime compilation will negatively impact the guest application performance.
The following cause was found: JVMCI is not enabled for this JVM. Enable JVMCI using -XX:+EnableJVMCI.
For more information see: https://www.graalvm.org/latest/reference-manual/embed-languages/#runtime-optimization-support.
To disable this warning use the '--engine.WarnInterpreterOnly=false' option or the '-Dpolyglot.engine.WarnInterpreterOnly=false' system property.
&#91;To redirect Truffle log output to a file use one of the following options:
* '--log.file=&lt;path>' if the option is passed using a guest language launcher.
* '-Dpolyglot.log.file=&lt;path>' if the option is passed using the host Java launcher.
* Configure logging using the polyglot embedding API.&#93;
&#91;engine&#93; WARNING: The polyglot engine uses a fallback runtime that does not support runtime compilation to native code.
Execution without runtime compilation will negatively impact the guest application performance.
The following cause was found: JVMCI is not enabled for this JVM. Enable JVMCI using -XX:+EnableJVMCI.
For more information see: https://www.graalvm.org/latest/reference-manual/embed-languages/#runtime-optimization-support.
To disable this warning use the '--engine.WarnInterpreterOnly=false' option or the '-Dpolyglot.engine.WarnInterpreterOnly=false' system property.
&#91;To redirect Truffle log output to a file use one of the following options:
* '--log.file=&lt;path>' if the option is passed using a guest language launcher.
* '-Dpolyglot.log.file=&lt;path>' if the option is passed using the host Java launcher.
* Configure logging using the polyglot embedding API.&#93;
&#91;engine&#93; WARNING: The polyglot engine uses a fallback runtime that does not support runtime compilation to native code.
Execution without runtime compilation will negatively impact the guest application performance.
The following cause was found: JVMCI is not enabled for this JVM. Enable JVMCI using -XX:+EnableJVMCI.
For more information see: https://www.graalvm.org/latest/reference-manual/embed-languages/#runtime-optimization-support.
To disable this warning use the '--engine.WarnInterpreterOnly=false' option or the '-Dpolyglot.engine.WarnInterpreterOnly=false' system property.
Connected to:
Oracle AI Database 26ai Free Release 23.26.2.0.0 - Develop, Learn, and Run for Free
Version 23.26.2.0.0

&#91;To redirect Truffle log output to a file use one of the following options:
* '--log.file=&lt;path>' if the option is passed using a guest language launcher.
* '-Dpolyglot.log.file=&lt;path>' if the option is passed using the host Java launcher.
* Configure logging using the polyglot embedding API.&#93;
&#91;engine&#93; WARNING: The polyglot engine uses a fallback runtime that does not support runtime compilation to native code.
Execution without runtime compilation will negatively impact the guest application performance.
The following cause was found: JVMCI is not enabled for this JVM. Enable JVMCI using -XX:+EnableJVMCI.
For more information see: https://www.graalvm.org/latest/reference-manual/embed-languages/#runtime-optimization-support.
To disable this warning use the '--engine.WarnInterpreterOnly=false' option or the '-Dpolyglot.engine.WarnInterpreterOnly=false' system property.
Hello from GraalJS
SQL> </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">SQLcl: Release 26.2 Production on Sat Jul 25 12:20:22 2026</span></span>
<span class="line"><span style="color: #D4D4D4"></span></span>
<span class="line"><span style="color: #D4D4D4">Copyright (c) 1982, 2026, Oracle.  All rights reserved.</span></span>
<span class="line"><span style="color: #D4D4D4"></span></span>
<span class="line"><span style="color: #D4D4D4">WARNING: A restricted method in java.lang.System has been called</span></span>
<span class="line"><span style="color: #D4D4D4">WARNING: java.lang.System::load has been called by com.oracle.truffle.polyglot.JDKSupport in module org.graalvm.truffle (file:/Users/phs/.vscode/extensions/oracle.sql-developer-26.2.0-darwin-arm64/dbtools/sqlcl/lib/truffle-api-25.1.3.jar)</span></span>
<span class="line"><span style="color: #D4D4D4">WARNING: Use --enable-native-access=org.graalvm.truffle to avoid a warning for callers in this module</span></span>
<span class="line"><span style="color: #D4D4D4">WARNING: Restricted methods will be blocked in a future release unless native access is enabled</span></span>
<span class="line"><span style="color: #D4D4D4"></span></span>
<span class="line"><span style="color: #D4D4D4">&#91;To redirect Truffle log output to a file use one of the following options:</span></span>
<span class="line"><span style="color: #D4D4D4">* &#39;--log.file=&lt;path&gt;&#39; if the option is passed using a guest language launcher.</span></span>
<span class="line"><span style="color: #D4D4D4">* &#39;-Dpolyglot.log.file=&lt;path&gt;&#39; if the option is passed using the host Java launcher.</span></span>
<span class="line"><span style="color: #D4D4D4">* Configure logging using the polyglot embedding API.&#93;</span></span>
<span class="line"><span style="color: #D4D4D4">&#91;engine&#93; WARNING: The polyglot engine uses a fallback runtime that does not support runtime compilation to native code.</span></span>
<span class="line"><span style="color: #D4D4D4">Execution without runtime compilation will negatively impact the guest application performance.</span></span>
<span class="line"><span style="color: #D4D4D4">The following cause was found: JVMCI is not enabled for this JVM. Enable JVMCI using -XX:+EnableJVMCI.</span></span>
<span class="line"><span style="color: #D4D4D4">For more information see: https://www.graalvm.org/latest/reference-manual/embed-languages/#runtime-optimization-support.</span></span>
<span class="line"><span style="color: #D4D4D4">To disable this warning use the &#39;--engine.WarnInterpreterOnly=false&#39; option or the &#39;-Dpolyglot.engine.WarnInterpreterOnly=false&#39; system property.</span></span>
<span class="line"><span style="color: #D4D4D4">&#91;To redirect Truffle log output to a file use one of the following options:</span></span>
<span class="line"><span style="color: #D4D4D4">* &#39;--log.file=&lt;path&gt;&#39; if the option is passed using a guest language launcher.</span></span>
<span class="line"><span style="color: #D4D4D4">* &#39;-Dpolyglot.log.file=&lt;path&gt;&#39; if the option is passed using the host Java launcher.</span></span>
<span class="line"><span style="color: #D4D4D4">* Configure logging using the polyglot embedding API.&#93;</span></span>
<span class="line"><span style="color: #D4D4D4">&#91;engine&#93; WARNING: The polyglot engine uses a fallback runtime that does not support runtime compilation to native code.</span></span>
<span class="line"><span style="color: #D4D4D4">Execution without runtime compilation will negatively impact the guest application performance.</span></span>
<span class="line"><span style="color: #D4D4D4">The following cause was found: JVMCI is not enabled for this JVM. Enable JVMCI using -XX:+EnableJVMCI.</span></span>
<span class="line"><span style="color: #D4D4D4">For more information see: https://www.graalvm.org/latest/reference-manual/embed-languages/#runtime-optimization-support.</span></span>
<span class="line"><span style="color: #D4D4D4">To disable this warning use the &#39;--engine.WarnInterpreterOnly=false&#39; option or the &#39;-Dpolyglot.engine.WarnInterpreterOnly=false&#39; system property.</span></span>
<span class="line"><span style="color: #D4D4D4">WARNING: A terminally deprecated method in sun.misc.Unsafe has been called</span></span>
<span class="line"><span style="color: #D4D4D4">WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.oracle.truffle.api.strings.TStringUnsafe (file:/Users/phs/.vscode/extensions/oracle.sql-developer-26.2.0-darwin-arm64/dbtools/sqlcl/lib/truffle-api-25.1.3.jar)</span></span>
<span class="line"><span style="color: #D4D4D4">WARNING: Please consider reporting this to the maintainers of class com.oracle.truffle.api.strings.TStringUnsafe</span></span>
<span class="line"><span style="color: #D4D4D4">WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release</span></span>
<span class="line"><span style="color: #D4D4D4">&#91;To redirect Truffle log output to a file use one of the following options:</span></span>
<span class="line"><span style="color: #D4D4D4">* &#39;--log.file=&lt;path&gt;&#39; if the option is passed using a guest language launcher.</span></span>
<span class="line"><span style="color: #D4D4D4">* &#39;-Dpolyglot.log.file=&lt;path&gt;&#39; if the option is passed using the host Java launcher.</span></span>
<span class="line"><span style="color: #D4D4D4">* Configure logging using the polyglot embedding API.&#93;</span></span>
<span class="line"><span style="color: #D4D4D4">&#91;engine&#93; WARNING: The polyglot engine uses a fallback runtime that does not support runtime compilation to native code.</span></span>
<span class="line"><span style="color: #D4D4D4">Execution without runtime compilation will negatively impact the guest application performance.</span></span>
<span class="line"><span style="color: #D4D4D4">The following cause was found: JVMCI is not enabled for this JVM. Enable JVMCI using -XX:+EnableJVMCI.</span></span>
<span class="line"><span style="color: #D4D4D4">For more information see: https://www.graalvm.org/latest/reference-manual/embed-languages/#runtime-optimization-support.</span></span>
<span class="line"><span style="color: #D4D4D4">To disable this warning use the &#39;--engine.WarnInterpreterOnly=false&#39; option or the &#39;-Dpolyglot.engine.WarnInterpreterOnly=false&#39; system property.</span></span>
<span class="line"><span style="color: #D4D4D4">&#91;To redirect Truffle log output to a file use one of the following options:</span></span>
<span class="line"><span style="color: #D4D4D4">* &#39;--log.file=&lt;path&gt;&#39; if the option is passed using a guest language launcher.</span></span>
<span class="line"><span style="color: #D4D4D4">* &#39;-Dpolyglot.log.file=&lt;path&gt;&#39; if the option is passed using the host Java launcher.</span></span>
<span class="line"><span style="color: #D4D4D4">* Configure logging using the polyglot embedding API.&#93;</span></span>
<span class="line"><span style="color: #D4D4D4">&#91;engine&#93; WARNING: The polyglot engine uses a fallback runtime that does not support runtime compilation to native code.</span></span>
<span class="line"><span style="color: #D4D4D4">Execution without runtime compilation will negatively impact the guest application performance.</span></span>
<span class="line"><span style="color: #D4D4D4">The following cause was found: JVMCI is not enabled for this JVM. Enable JVMCI using -XX:+EnableJVMCI.</span></span>
<span class="line"><span style="color: #D4D4D4">For more information see: https://www.graalvm.org/latest/reference-manual/embed-languages/#runtime-optimization-support.</span></span>
<span class="line"><span style="color: #D4D4D4">To disable this warning use the &#39;--engine.WarnInterpreterOnly=false&#39; option or the &#39;-Dpolyglot.engine.WarnInterpreterOnly=false&#39; system property.</span></span>
<span class="line"><span style="color: #D4D4D4">&#91;To redirect Truffle log output to a file use one of the following options:</span></span>
<span class="line"><span style="color: #D4D4D4">* &#39;--log.file=&lt;path&gt;&#39; if the option is passed using a guest language launcher.</span></span>
<span class="line"><span style="color: #D4D4D4">* &#39;-Dpolyglot.log.file=&lt;path&gt;&#39; if the option is passed using the host Java launcher.</span></span>
<span class="line"><span style="color: #D4D4D4">* Configure logging using the polyglot embedding API.&#93;</span></span>
<span class="line"><span style="color: #D4D4D4">&#91;engine&#93; WARNING: The polyglot engine uses a fallback runtime that does not support runtime compilation to native code.</span></span>
<span class="line"><span style="color: #D4D4D4">Execution without runtime compilation will negatively impact the guest application performance.</span></span>
<span class="line"><span style="color: #D4D4D4">The following cause was found: JVMCI is not enabled for this JVM. Enable JVMCI using -XX:+EnableJVMCI.</span></span>
<span class="line"><span style="color: #D4D4D4">For more information see: https://www.graalvm.org/latest/reference-manual/embed-languages/#runtime-optimization-support.</span></span>
<span class="line"><span style="color: #D4D4D4">To disable this warning use the &#39;--engine.WarnInterpreterOnly=false&#39; option or the &#39;-Dpolyglot.engine.WarnInterpreterOnly=false&#39; system property.</span></span>
<span class="line"><span style="color: #D4D4D4">Connected to:</span></span>
<span class="line"><span style="color: #D4D4D4">Oracle AI Database 26ai Free Release 23.26.2.0.0 - Develop, Learn, and Run for Free</span></span>
<span class="line"><span style="color: #D4D4D4">Version 23.26.2.0.0</span></span>
<span class="line"><span style="color: #D4D4D4"></span></span>
<span class="line"><span style="color: #D4D4D4">&#91;To redirect Truffle log output to a file use one of the following options:</span></span>
<span class="line"><span style="color: #D4D4D4">* &#39;--log.file=&lt;path&gt;&#39; if the option is passed using a guest language launcher.</span></span>
<span class="line"><span style="color: #D4D4D4">* &#39;-Dpolyglot.log.file=&lt;path&gt;&#39; if the option is passed using the host Java launcher.</span></span>
<span class="line"><span style="color: #D4D4D4">* Configure logging using the polyglot embedding API.&#93;</span></span>
<span class="line"><span style="color: #D4D4D4">&#91;engine&#93; WARNING: The polyglot engine uses a fallback runtime that does not support runtime compilation to native code.</span></span>
<span class="line"><span style="color: #D4D4D4">Execution without runtime compilation will negatively impact the guest application performance.</span></span>
<span class="line"><span style="color: #D4D4D4">The following cause was found: JVMCI is not enabled for this JVM. Enable JVMCI using -XX:+EnableJVMCI.</span></span>
<span class="line"><span style="color: #D4D4D4">For more information see: https://www.graalvm.org/latest/reference-manual/embed-languages/#runtime-optimization-support.</span></span>
<span class="line"><span style="color: #D4D4D4">To disable this warning use the &#39;--engine.WarnInterpreterOnly=false&#39; option or the &#39;-Dpolyglot.engine.WarnInterpreterOnly=false&#39; system property.</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">Hello from GraalJS</span></span>
<span class="line"><span style="color: #D4D4D4">SQL&gt; </span></span></code></pre></div>
</details>



<p class="wp-block-paragraph">After several warnings, the expected result appears at the end.</p>



<p class="wp-block-paragraph">I explained the <a href="https://github.com/PhilippSalvisberg/sqlcl-js-patch/tree/main#graaljs-related-warnings" target="_blank" rel="noreferrer noopener">GraalJS-related warnings</a> in my GitHub repository. The following environment setting will suppress most of the warnings. Where you define this variable depends on your operating system and shell. In any case, the environment variable must be visible before you start VS Code.</p>



<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 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) Non-breaking JDK_JAVA_OPTIONS to suppress warnings</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>export JDK_JAVA_OPTIONS="-Dpolyglot.engine.WarnInterpreterOnly=false -Dpolyglot.js.nashorn-compat=true"</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">export</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">JDK_JAVA_OPTIONS</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;-Dpolyglot.engine.WarnInterpreterOnly=false -Dpolyglot.js.nashorn-compat=true&quot;</span></span></code></pre></div>



<p class="wp-block-paragraph">If you are only using JDK 24 or newer on your system, you can disable all warnings as follows. However, be aware that any JDK version below 24 will no longer work, because the Java runtime stops with an error when passing unknown JVM arguments.</p>



<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 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) Breaking JDK_JAVA_OPTIONS to suppress warnings</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>export JDK_JAVA_OPTIONS="--illegal-native-access=allow --sun-misc-unsafe-memory-access=allow -Dpolyglot.engine.WarnInterpreterOnly=false -Dpolyglot.js.nashorn-compat=true"</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">export</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">JDK_JAVA_OPTIONS</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;--illegal-native-access=allow --sun-misc-unsafe-memory-access=allow -Dpolyglot.engine.WarnInterpreterOnly=false -Dpolyglot.js.nashorn-compat=true&quot;</span></span></code></pre></div>



<h2 id="can-i-also-use-this-for-standalone-sqlcl" class="wp-block-heading">Can I Also Use This for Standalone SQLcl?</h2>



<p class="wp-block-paragraph">Yes.</p>



<p class="wp-block-paragraph">Pass the SQLcl installation directory instead of the VS Code configuration directory:</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) Patch standalone SQLcl with Nashorn JavaScript engine (macOS/Linux only)</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>curl --fail --location --silent --show-error \
  https://raw.githubusercontent.com/PhilippSalvisberg/sqlcl-js-patch/refs/heads/main/sqlcl-js-patch.sh |
  sh -s -- add nashorn "sqlcl_home=/path/to/sqlcl"</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: #DCDCAA">curl</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--fail</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--location</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--silent</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--show-error</span><span style="color: #D4D4D4"> </span><span style="color: #D7BA7D">\</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #CE9178">https://raw.githubusercontent.com/PhilippSalvisberg/sqlcl-js-patch/refs/heads/main/sqlcl-js-patch.sh</span><span style="color: #D4D4D4"> |</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">sh</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">-s</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">add</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">nashorn</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;sqlcl_home=/path/to/sqlcl&quot;</span></span></code></pre></div>



<p class="wp-block-paragraph">This works very well on macOS and Linux. Besides installing the Nashorn libraries, the patch removes the following option from the <code>bin/sql</code> launcher:</p>



<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>-Dnashorn.args=--no-deprecation-warning</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">-</span><span style="color: #9CDCFE">Dnashorn</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">args</span><span style="color: #D4D4D4">=--no-deprecation-warning</span></span></code></pre></div>



<p class="wp-block-paragraph">The standalone Nashorn engine does not support this option. It throws an exception while the engine is initialised, and SQLcl consequently reports <code>JavaScript engine not found.</code></p>



<p class="wp-block-paragraph">On Windows, <code>bin/sql.exe</code> is a binary executable. The patch script cannot modify it. It can add the Nashorn libraries when run from Git Bash, but it cannot apply the necessary launcher workaround. Therefore, Nashorn does not work with standalone SQLcl on Windows. GraalJS does not need this launcher change and is therefore the only option supported by the patch script on Windows:</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">8) Patch standalone SQLcl with GraalJS JavaScript engine</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>curl --fail --location --silent --show-error \
  https://raw.githubusercontent.com/PhilippSalvisberg/sqlcl-js-patch/refs/heads/main/sqlcl-js-patch.sh |
  sh -s -- add graaljs "sqlcl_home=/path/to/sqlcl"</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: #DCDCAA">curl</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--fail</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--location</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--silent</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--show-error</span><span style="color: #D4D4D4"> </span><span style="color: #D7BA7D">\</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #CE9178">https://raw.githubusercontent.com/PhilippSalvisberg/sqlcl-js-patch/refs/heads/main/sqlcl-js-patch.sh</span><span style="color: #D4D4D4"> |</span></span>
<span class="line cbp-line-highlight"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">sh</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">-s</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">--</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">add</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">graaljs</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;sqlcl_home=/path/to/sqlcl&quot;</span></span></code></pre></div>



<p class="wp-block-paragraph">This raises an interesting question. SQL Developer for VS Code also includes a Windows <code>bin/sql.exe</code> that the patch script cannot modify. So why does Nashorn work there?</p>



<h2 id="but-why-does-nashorn-work-in-embedded-sqlcl" class="wp-block-heading">But Why Does Nashorn Work in Embedded SQLcl?</h2>



<p class="wp-block-paragraph">I mentioned before that the embedded SQLcl version has a different folder structure (there is no <code>lib/ext</code> folder for third-party libraries). But that&#8217;s not the only difference. </p>



<p class="wp-block-paragraph">The launcher is also different. Neither <code>bin/sql</code> nor <code>bin/sql.exe</code> includes the <code>-Dnashorn.args=--no-deprecation-warning</code> JVM option.</p>



<p class="wp-block-paragraph"> As a result, the Nashorn JavaScript engine works in the embedded SQLcl version of SQL Developer for VS Code.</p>



<h2 id="outlook" class="wp-block-heading">Outlook</h2>



<p class="wp-block-paragraph">I hope this helps you bring the SQLcl <code>script</code> command back to life in your environments, especially in SQL Developer for VS Code, where using another Java runtime is not a practical option.</p>



<p class="wp-block-paragraph">However, I also hope that we will not have to run <code>sqlcl-js-patch.sh</code> for every new SQLcl or SQL Developer extension version until the end of time. The patch consists mainly of adding libraries that are available from Maven Central. It would be great if the Oracle SQL Developer team included these libraries in a future update and made the <code>script</code> command work out of the box again.</p>



<p class="wp-block-paragraph"><em>Updated on 2026-07-27, mentioned OpenJDK Nashorn in paragraph 2</em>.</p>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://www.salvis.com/blog/2026/07/25/the-return-of-sqlcls-script-command/">The Return of SQLcl&#8217;s SCRIPT Command</a> appeared first on <a href="https://www.salvis.com/blog">Philipp Salvisberg&#039;s Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.salvis.com/blog/2026/07/25/the-return-of-sqlcls-script-command/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Installing MLE Modules in the Oracle Database</title>
		<link>https://www.salvis.com/blog/2023/11/26/installing-mle-modules-in-the-oracle-database/</link>
		
		<dc:creator><![CDATA[Philipp Salvisberg]]></dc:creator>
		<pubDate>Sun, 26 Nov 2023 17:56:09 +0000</pubDate>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MLE]]></category>
		<category><![CDATA[Oracle 26ai]]></category>
		<category><![CDATA[PL/SQL]]></category>
		<category><![CDATA[SQLcl]]></category>
		<guid isPermaLink="false">https://www.salvis.com/blog/?p=12931</guid>

					<description><![CDATA[<p>Introduction In my previous blog post, I&#8217;ve shown how you can deploy an npm module from a URL and a custom ESM module from a local file into a remote Oracle Database 23c using JavaScript and SQLcl. This works well. However, for two MLE modules, I had to write 22 lines of<span class="excerpt-hellip"> […]</span></p>
<p>The post <a href="https://www.salvis.com/blog/2023/11/26/installing-mle-modules-in-the-oracle-database/">Installing MLE Modules in the Oracle Database</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 class="wp-block-paragraph">In my <a href="https://www.salvis.com/blog/2023/11/12/mle-typescript-javascript-modules/#deployment">previous blog post</a>, I&#8217;ve shown how you can deploy an npm module from a URL and a custom ESM module from a local file into a remote Oracle Database 23c using JavaScript and SQLcl. This works well. However, for two MLE modules, I had to write 22 lines of code with duplications. I do not like that. I have therefore developed a small SQLcl custom command that greatly simplifies the installation of MLE modules in the Oracle Database.</p>



<h2 class="wp-block-heading">Installing the <code>mle</code> Custom Command</h2>



<p class="wp-block-paragraph">Start SQLcl and run the following command to install the custom command <code>mle</code> in the current session.</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:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="script https://raw.githubusercontent.com/PhilippSalvisberg/mle-sqlcl/main/mle.js register" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">script https://raw.githubusercontent.com/PhilippSalvisberg/mle-sqlcl/main/mle.js register</span></span></code></pre></div>



<p class="wp-block-paragraph">The SQLcl script command can read a JavaScript file from the local file system or from a URL. If you feel uncomfortable running JavaScript files directly from a URL, you can have a look at the <a href="https://github.com/PhilippSalvisberg/mle-sqlcl">GitHub repo</a> first and download and run a chosen version of the script from the local file system.</p>



<p class="wp-block-paragraph">The <code>register</code> subcommand registers the <code>mle</code> script as an SQLcl command. However, this registration is not permanent. It will be lost after closing SQLcl. To make the custom command available in every new SQLcl session add the command above to your <code>login.sql</code> or <code>startup.sql</code>. SQLcl executes these files on start-up or after establishing a new connection. Just make sure that you have configured the <code>SQLPATH</code> environment variable accordingly. </p>



<h2 class="wp-block-heading">Providing Help</h2>



<p class="wp-block-paragraph">Now you can run the <code>mle</code> command 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);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="mle" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">mle</span></span></code></pre></div>



<p class="wp-block-paragraph">Without parameters, an error message is displayed along with information on how to use this command.</p>



<figure class="wp-block-image size-full"><a href="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-2.png"><img fetchpriority="high" decoding="async" width="650" height="498" src="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-2.png" alt="Output of mle command without parameters" class="wp-image-12934" srcset="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-2.png 650w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-2-300x230.png 300w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-2-98x75.png 98w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-2-480x368.png 480w" sizes="(max-width:767px) 480px, 650px" /></a></figure>



<h2 class="wp-block-heading">Installing Validator</h2>



<p class="wp-block-paragraph">Now we know the syntax to install an MLE module from a URL. However, what&#8217;s the URL for an npm module? We use the free OpenSource CDN <a href="https://www.jsdelivr.com/?docs=esm">jsDelivr</a> for that. They provide a service returning an npm module as an ECMAScript module. The result can be used in a browser and also in an Oracle Database. The URL looks 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);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="https://esm.run/npm-package-name@npm-package-version" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">https://esm.run/npm-package-name@npm-package-version</span></span></code></pre></div>



<p class="wp-block-paragraph">We want to install the current version 13.11.0 of the npm module <a href="https://www.npmjs.com/package/validator">validator</a>. Based on the information provided above our SQLcl command for that looks 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);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="mle install validator_mod https://esm.run/validator@13.11.0 13.11.0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">mle install validator_mod https://esm.run/validator@13.</span><span style="color: #B5CEA8">11</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4"> </span><span style="color: #B5CEA8">13</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">11</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">0</span></span></code></pre></div>



<p class="wp-block-paragraph">And here is the result in SQLcl :</p>



<figure class="wp-block-image size-full"><a href="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-9.png"><img decoding="async" width="642" height="194" src="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-9.png" alt="Output of successfully executed mle command to install the validator module from npm" class="wp-image-12945" srcset="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-9.png 642w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-9-300x91.png 300w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-9-150x45.png 150w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-9-480x145.png 480w" sizes="(max-width:767px) 480px, 642px" /></a></figure>



<p class="wp-block-paragraph">Please note that the response message by SQLcl 23.3 is not 100% correct for MLE modules. However, our module is installed correctly. We verify that later.</p>



<p class="wp-block-paragraph">Maybe you&#8217;d like to know what the SQL statement looks like to install this module. The last statement is still in SQLcl&#8217;s buffer. Therefore we can type <code>l</code> followed by <code>enter</code> to see the content of the buffer.</p>


<div class="accordion"><div class="mfn-acc accordion_wrapper  toggle"><br />
<div class="question"><div class="title"><i class="icon-plus acc-icon-plus" aria-hidden="true"></i><i class="icon-minus acc-icon-minus" aria-hidden="true"></i>SQLcl's buffer</div><div class="answer"></p>



<p class="wp-block-paragraph">The first line contains the start of the SQL statement. Lines 2 to 7 are comments generated by jsDelivr. Line 8 contains the complete module. Yes, as a single line. The code is minified. All unnecessary whitespace is gone and internally used identifiers are shortened to save space. On line 9 we would see a JavaScript comment with a pointer to a map file that points to the original, nicely formatted source code. This is interesting when debugging in other environments. It&#8217;s currently not used in the database.</p>



<figure class="wp-block-image size-full"><a href="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-7.png"><img decoding="async" width="1050" height="17704" src="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-7.png" alt="SQLcl buffer containing the SQL command to install the validator module" class="wp-image-12937"/></a></figure>


<p></div></div>
<br />
</div></div>




<h2 class="wp-block-heading">Querying MLE Modules</h2>



<p class="wp-block-paragraph">The following SQL statement shows some data regarding the previously deployed MLE module:</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:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="set sqlformat ansiconsole
select module_name, version, language_name, length(module)
  from user_mle_modules;" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">set</span><span style="color: #D4D4D4"> sqlformat ansiconsole</span></span>
<span class="line"><span style="color: #569CD6">select</span><span style="color: #D4D4D4"> module_name, </span><span style="color: #569CD6">version</span><span style="color: #D4D4D4">, language_name, </span><span style="color: #569CD6">length</span><span style="color: #D4D4D4">(module)</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">from</span><span style="color: #D4D4D4"> user_mle_modules;</span></span></code></pre></div>



<p class="wp-block-paragraph">The result in SQLcl looks like this:</p>



<figure class="wp-block-image size-full"><a href="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-8.png"><img loading="lazy" decoding="async" width="642" height="171" src="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-8.png" alt="" class="wp-image-12944" srcset="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-8.png 642w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-8-300x80.png 300w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-8-150x40.png 150w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-8-480x128.png 480w" sizes="auto, (max-width:767px) 480px, 642px" /></a></figure>



<p class="wp-block-paragraph">We see the version of the module and also the size in bytes of the blob column where the module is stored. It is one byte larger than the result of the URL since It contains a final line feed character due to the way we built the SQL statement.</p>



<p class="wp-block-paragraph">IMO it is helpful to provide the version of the external ESM as long as there is no proper package registry within the Oracle Database.</p>



<h2 class="wp-block-heading">Verifying Installation</h2>



<p class="wp-block-paragraph">Let&#8217;s write a call specification in order to verify the successful installation of the validator module.</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:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="create or replace function is_email(
   in_email in varchar2
) return boolean as mle module validator_mod signature 'default.isEmail(string)';
/" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">create or replace</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">function</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">is_email</span><span style="color: #D4D4D4">(</span></span>
<span class="line"><span style="color: #D4D4D4">   in_email </span><span style="color: #569CD6">in</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">varchar2</span></span>
<span class="line"><span style="color: #D4D4D4">) </span><span style="color: #569CD6">return</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">boolean</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">as</span><span style="color: #D4D4D4"> mle module validator_mod </span><span style="color: #569CD6">signature</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;default.isEmail(string)&#39;</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">/</span></span></code></pre></div>



<p class="wp-block-paragraph">Now we can run the following query to verify e-mail addresses and the installation of the validator module:</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:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="select is_email('jane.doe@example.org') as jane_doe,
       is_email('john.doe@example') as john_doe;" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">select</span><span style="color: #D4D4D4"> is_email(</span><span style="color: #CE9178">&#39;jane.doe@example.org&#39;</span><span style="color: #D4D4D4">) </span><span style="color: #569CD6">as</span><span style="color: #D4D4D4"> jane_doe,</span></span>
<span class="line"><span style="color: #D4D4D4">       is_email(</span><span style="color: #CE9178">&#39;john.doe@example&#39;</span><span style="color: #D4D4D4">) </span><span style="color: #569CD6">as</span><span style="color: #D4D4D4"> john_doe;</span></span></code></pre></div>



<p class="wp-block-paragraph">In SQLcl 23.3 the result looks like this (boolean values as <code>1</code> and <code>0</code>):</p>



<figure class="wp-block-image size-full"><a href="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-10.png"><img loading="lazy" decoding="async" width="642" height="189" src="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-10.png" alt="Result of calling the is_email validator function in SQLcl" class="wp-image-12949" srcset="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-10.png 642w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-10-300x88.png 300w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-10-150x44.png 150w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-10-480x141.png 480w" sizes="auto, (max-width:767px) 480px, 642px" /></a></figure>



<p class="wp-block-paragraph">And in SQL*Plus 23.3 the result looks like this (boolean values as <code>TRUE</code> and <code>FALSE</code>):</p>



<figure class="wp-block-image size-full"><a href="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-12.png"><img loading="lazy" decoding="async" width="642" height="193" src="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-12.png" alt="Result of calling the is_email validator function in SQL*Plus" class="wp-image-12952" srcset="https://www.salvis.com/blog/wp-content/uploads/2023/11/image-12.png 642w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-12-300x90.png 300w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-12-150x45.png 150w, https://www.salvis.com/blog/wp-content/uploads/2023/11/image-12-480x144.png 480w" sizes="auto, (max-width:767px) 480px, 642px" /></a></figure>



<h2 class="wp-block-heading">Installing More Modules</h2>



<p class="wp-block-paragraph">Let&#8217;s install some other modules I find useful. You find them on <a href="https://www.npmjs.com/">npm</a> if you want to know what they do.</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:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="mle install sentiment_mod https://esm.run/sentiment@5.0.2 5.0.22
mle install jimp_mod https://esm.run/jimp@0.22.10/browser/lib/jimp.js 0.22.10
mle install sql_assert_mod https://esm.run/sql-assert@1.0.3 1.0.3
mle install lodash_mod https://esm.run/lodash@4.17.21 4.17.21
mle install js_yaml_mod https://esm.run/js-yaml@4.1.0 4.1.0
mle install minimist_mod https://esm.run/minimist@1.2.8 1.2.8
mle install typeorm_mod https://esm.run/typeorm@0.3.17 0.3.17" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">mle install sentiment_mod https://esm.run/sentiment@5.</span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">2</span><span style="color: #D4D4D4"> </span><span style="color: #B5CEA8">5</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">22</span></span>
<span class="line"><span style="color: #D4D4D4">mle install jimp_mod https://esm.run/jimp@0.</span><span style="color: #B5CEA8">22</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">10</span><span style="color: #D4D4D4">/browser/lib/jimp.js </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">22</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">10</span></span>
<span class="line"><span style="color: #D4D4D4">mle install sql_assert_mod https://esm.run/</span><span style="color: #569CD6">sql</span><span style="color: #D4D4D4">-assert@1.</span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">3</span><span style="color: #D4D4D4"> </span><span style="color: #B5CEA8">1</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">3</span></span>
<span class="line"><span style="color: #D4D4D4">mle install lodash_mod https://esm.run/lodash@4.</span><span style="color: #B5CEA8">17</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">21</span><span style="color: #D4D4D4"> </span><span style="color: #B5CEA8">4</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">17</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">21</span></span>
<span class="line"><span style="color: #D4D4D4">mle install js_yaml_mod https://esm.run/js-yaml@4.</span><span style="color: #B5CEA8">1</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4"> </span><span style="color: #B5CEA8">4</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">1</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">0</span></span>
<span class="line"><span style="color: #D4D4D4">mle install minimist_mod https://esm.run/minimist@1.</span><span style="color: #B5CEA8">2</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">8</span><span style="color: #D4D4D4"> </span><span style="color: #B5CEA8">1</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">2</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">8</span></span>
<span class="line"><span style="color: #D4D4D4">mle install typeorm_mod https://esm.run/typeorm@0.</span><span style="color: #B5CEA8">3</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">17</span><span style="color: #D4D4D4"> </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">3</span><span style="color: #D4D4D4">.</span><span style="color: #B5CEA8">17</span></span></code></pre></div>



<p class="wp-block-paragraph">Installing all modules is just a matter of a few seconds. </p>



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



<p class="wp-block-paragraph">Using the SQLcl custom <code>mle</code> command to install ECMAScript modules from a file or from a URL is not only easy and fast, but it is also an excellent way to provide tested functionality within the database. </p>



<p class="wp-block-paragraph">Technically it should be possible to generate the PL/SQL call specifications based on the information that is provided for IDEs to better support code completion (type definitions). I hope that Oracle will provide such a feature in one of the coming releases of SQLcl or as part of a dedicated MLE tool (similar to <code>dbjs</code> which was part of the experimental version of the MLE back in 2017). Even if I do not want to provide access to all underlying functionality of an MLE module within the database or provide the functionality with the same signature, a PL/SQL package with all call specifications would simplify the work for a wrapper PL/SQL package that exposes just the relevant subset in a suitable way for the use in PL/SQL or SQL.</p>
<p>The post <a href="https://www.salvis.com/blog/2023/11/26/installing-mle-modules-in-the-oracle-database/">Installing MLE Modules in the Oracle Database</a> appeared first on <a href="https://www.salvis.com/blog">Philipp Salvisberg&#039;s Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Patching SQL Developer 20.2 with SQLcl&#8217;s Formatter</title>
		<link>https://www.salvis.com/blog/2020/11/01/patching-sql-developer-20-2-with-sqlcls-formatter/</link>
					<comments>https://www.salvis.com/blog/2020/11/01/patching-sql-developer-20-2-with-sqlcls-formatter/#comments</comments>
		
		<dc:creator><![CDATA[Philipp Salvisberg]]></dc:creator>
		<pubDate>Sun, 01 Nov 2020 15:37:09 +0000</pubDate>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Arbori]]></category>
		<category><![CDATA[PL/SQL]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Developer]]></category>
		<category><![CDATA[SQLcl]]></category>
		<guid isPermaLink="false">https://www.salvis.com/blog/?p=10802</guid>

					<description><![CDATA[<p>Introduction SQLcl 20.3.0 was released on October 29, 2020. It&#8217;s the first time I remember that we have a SQLcl version without the corresponding SQL Developer version. This is a pity because this SQLcl version also contains formatter fixes. And formatting code is something I do more often in the full-blown IDE<span class="excerpt-hellip"> […]</span></p>
<p>The post <a href="https://www.salvis.com/blog/2020/11/01/patching-sql-developer-20-2-with-sqlcls-formatter/">Patching SQL Developer 20.2 with SQLcl&#8217;s Formatter</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 class="wp-block-paragraph">SQLcl 20.3.0 was released on October 29, 2020. It&#8217;s the first time I remember that we have a SQLcl version without the corresponding SQL Developer version. This is a pity because this SQLcl version also contains formatter fixes. And formatting code is something I do more often in the full-blown IDE than in the stripped-down command line interface. In this blog post, I show you how you can patch your SQL Developer installation and make the formatter fixes available there as well.</p>



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



<p class="wp-block-paragraph">What I do here is an experiment and most probably not really legal. It&#8217;s nothing I suggest you should do in your production environment. If you feel uneasy, don&#8217;t do it. What you do might destroy your SQL Developer installation.</p>



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



<p class="wp-block-paragraph">For this experiment you need</p>



<ul class="wp-block-list">
<li>SQLcl 20.3.0</li>



<li>SQL Developer 20.2.0</li>



<li>JDK8 or JDK11</li>
</ul>



<p class="wp-block-paragraph">These software components are all installed on your computer. I do not explain in this blog post how to do it.</p>



<h2 class="wp-block-heading">Solution Approach</h2>



<p class="wp-block-paragraph">SQLcl and SQL Developer provide a <code>dbtools-common.jar</code> file. This file contains the formatter (besides other things). We copy this file from the SQLcl installation to the SQL Developer installation.</p>



<p class="wp-block-paragraph">That would be all if SQL Developer would load the Guava library before opening a connection. But it does not because it was not required for version 20.2 of <code>dbtools-common.jar</code>. Therefore we put the <code>VersionTracker.class</code> and the <code>SetServerOutput.class</code> (which do not use Guava) from the original SQL Developer installation into the <code>dbtools-common.jar</code> file.</p>



<p class="wp-block-paragraph">Another option would be to embed the classes from the&nbsp;<code>guava.jar</code>.</p>



<h2 class="wp-block-heading">Step by Step Instruction</h2>



<h3 class="wp-block-heading">Step 1 &#8211; Quit SQL Developer</h3>



<p class="wp-block-paragraph">We are going to patch SQL Developer. This is not possible on Windows if SQL Developer is running. On other OS this might have strange effects. Therefore quit SQL Developer.</p>



<h3 class="wp-block-heading">Step 2 &#8211; Rename SQLDev&#8217;s <code>dbtools-common.jar</code></h3>



<p class="wp-block-paragraph">Find the <code>dbtools-common.jar</code> in your SQL Developer installation. In my case the file is in this directory: <code>/Applications/SQLDeveloper20.2.0.app/Contents/Resources/sqldeveloper/sqldeveloper/lib</code>. Rename this file to <code>dbtools-common.original.jar</code>.</p>


<div class="jq-tabs tabs_wrapper tabs_horizontal"><ul><li><a href="#tab-6a7d48a51c860-1">macOS</a></li><li><a href="#tab-6a7d48a51c860-2">Windows</a></li></ul><div id="tab-6a7d48a51c860-1" ></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">Rename SQLDev&#8217;s dbtools-common.jar</span><span role="button" tabindex="0" data-code="cd /Applications/SQLDeveloper20.2.0.app/Contents/Resources/sqldeveloper/sqldeveloper/lib
mv dbtools-common.jar dbtools-common.original.jar" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #DCDCAA">cd</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">/Applications/SQLDeveloper20.2.0.app/Contents/Resources/sqldeveloper/sqldeveloper/lib</span></span>
<span class="line"><span style="color: #DCDCAA">mv</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">dbtools-common.jar</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">dbtools-common.original.jar</span></span></code></pre></div>


<p></div><div id="tab-6a7d48a51c860-2" ></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">Rename SQLDev&#8217;s dbtools-common.jar</span><span role="button" tabindex="0" data-code="cd C:\app\sqldeveloper20.2.0\sqldeveloper\lib
ren dbtools-common.jar dbtools-common.original.jar" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">cd C:\app\sqldeveloper20.</span><span style="color: #B5CEA8">2.0</span><span style="color: #D4D4D4">\sqldeveloper\lib</span></span>
<span class="line"><span style="color: #D4D4D4">ren dbtools-common.jar dbtools-common.original.jar</span></span></code></pre></div>


<p></div></div>



<h3 class="wp-block-heading">Step 3 &#8211; Copy SQLcl&#8217;s <code>dbtools-common.jar</code></h3>



<p class="wp-block-paragraph">Find the <code>dbtools-common.jar</code> in your SQLcl installation. In my case, the file is in this directory: <code>/usr/local/bin/sqlcl/lib</code>. Copy the file to the SQLDev&#8217;s directory (where the <code>dbtools-common.original.jar</code> is located).</p>


<div class="jq-tabs tabs_wrapper tabs_horizontal"><ul><li><a href="#tab-6a7d48a51c923-1">macOS</a></li><li><a href="#tab-6a7d48a51c923-2">Windows</a></li></ul><div id="tab-6a7d48a51c923-1" ></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">Copy SQLcl’s dbtools-common.jar</span><span role="button" tabindex="0" data-code="cd /usr/local/bin/sqlcl/lib
cp dbtools-common.jar /Applications/SQLDeveloper20.2.0.app/Contents/Resources/sqldeveloper/sqldeveloper/lib" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #DCDCAA">cd</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">/usr/local/bin/sqlcl/lib</span></span>
<span class="line"><span style="color: #DCDCAA">cp</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">dbtools-common.jar</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">/Applications/SQLDeveloper20.2.0.app/Contents/Resources/sqldeveloper/sqldeveloper/lib</span></span></code></pre></div>


<p></div><div id="tab-6a7d48a51c923-2" ></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">Copy SQLcl’s dbtools-common.jar</span><span role="button" tabindex="0" data-code="cd C:\app\sqlcl\lib
copy dbtools-common.jar C:\app\sqldeveloper20.2.0\sqldeveloper\lib" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">cd C:\app\sqlcl\lib</span></span>
<span class="line"><span style="color: #D4D4D4">copy dbtools-common.jar C:\app\sqldeveloper20.</span><span style="color: #B5CEA8">2.0</span><span style="color: #D4D4D4">\sqldeveloper\lib</span></span></code></pre></div>


<p></div></div>



<p class="wp-block-paragraph"></p>



<h3 class="wp-block-heading">Step 4 &#8211; Patch <code>dbtools-common.jar</code></h3>



<p class="wp-block-paragraph">Open a terminal window and change to the directory of the <code>dbtools-common.original.jar</code> file. Run there the following commands to create a patched version of <code>dbtools-common.jar</code>:</p>


<div class="jq-tabs tabs_wrapper tabs_horizontal"><ul><li><a href="#tab-6a7d48a51c9c0-1">macOS</a></li><li><a href="#tab-6a7d48a51c9c0-2">Windows</a></li></ul><div id="tab-6a7d48a51c9c0-1" ></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">Patch dbtools-common.jar</span><span role="button" tabindex="0" data-code="cd /Applications/SQLDeveloper20.2.0.app/Contents/Resources/sqldeveloper/sqldeveloper/lib
jar -xvf dbtools-common.original.jar oracle/dbtools/db/VersionTracker.class
jar -xvf dbtools-common.original.jar oracle/dbtools/raptor/newscriptrunner/commands/SetServerOutput.class
jar -u0vMf dbtools-common.jar oracle/dbtools
rm -rf oracle" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #DCDCAA">cd</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">/Applications/SQLDeveloper20.2.0.app/Contents/Resources/sqldeveloper/sqldeveloper/lib</span></span>
<span class="line"><span style="color: #DCDCAA">jar</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">-xvf</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">dbtools-common.original.jar</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">oracle/dbtools/db/VersionTracker.class</span></span>
<span class="line"><span style="color: #DCDCAA">jar</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">-xvf</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">dbtools-common.original.jar</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">oracle/dbtools/raptor/newscriptrunner/commands/SetServerOutput.class</span></span>
<span class="line"><span style="color: #DCDCAA">jar</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">-u0vMf</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">dbtools-common.jar</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">oracle/dbtools</span></span>
<span class="line"><span style="color: #DCDCAA">rm</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">-rf</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">oracle</span></span></code></pre></div>


<p></div><div id="tab-6a7d48a51c9c0-2" ></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">Patch dbtools-common.jar</span><span role="button" tabindex="0" data-code="cd C:\app\sqldeveloper20.2.0\sqldeveloper\lib
jar -xvf dbtools-common.original.jar oracle/dbtools/db/VersionTracker.class
jar -xvf dbtools-common.original.jar oracle/dbtools/raptor/newscriptrunner/commands/SetServerOutput.class
jar -u0vMf dbtools-common.jar oracle/dbtools
rmdir /s /q oracle" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">cd C:\app\sqldeveloper20.</span><span style="color: #B5CEA8">2.0</span><span style="color: #D4D4D4">\sqldeveloper\lib</span></span>
<span class="line"><span style="color: #D4D4D4">jar -xvf dbtools-common.original.jar oracle/dbtools/db/VersionTracker.class</span></span>
<span class="line"><span style="color: #D4D4D4">jar -xvf dbtools-common.original.jar oracle/dbtools/raptor/newscriptrunner/commands/SetServerOutput.class</span></span>
<span class="line"><span style="color: #D4D4D4">jar -u0vMf dbtools-common.jar oracle/dbtools</span></span>
<span class="line"><span style="color: #D4D4D4">rmdir /s /q oracle</span></span></code></pre></div>


<p></div></div>



<p class="wp-block-paragraph">Here is some explanation:</p>



<ul class="wp-block-list">
<li>First, we change to the directory where the files dbtools-common.original.jar (version 20.2.0) and dbtools-common.jar (version 20.3.0)  are stored. In your case, the directory name may differ.</li>



<li>On the second and third line, we extract the <code>VersionTracker.class</code> and the <code>SetServerOutput.class</code> from the <code>dbtools-common.original.jar</code> file. The classes are stored in a newly created directory <code>oracle</code>.</li>



<li>On the fourth line, we copy the previously extracted classes into the <code>dbtools-common.jar</code> file.</li>



<li>And on the last line, we remove the <code>oracle</code> directory and its subdirectories.</li>
</ul>



<h3 class="wp-block-heading">Formatter Improvements</h3>



<p class="wp-block-paragraph">An example is the best to show the difference between version 20.2 and 20.3. I use the default formatter settings with just one change. &#8220;No breaks&#8221; for &#8220;Line Breaks On Boolean connectors&#8221;.</p>



<figure class="wp-block-image"><a href="https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev_formatter_prefs.png"><img loading="lazy" decoding="async" width="349" height="567" src="https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev_formatter_prefs.png" alt="" class="wp-image-10821" srcset="https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev_formatter_prefs.png 349w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev_formatter_prefs-185x300.png 185w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev_formatter_prefs-90x146.png 90w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev_formatter_prefs-31x50.png 31w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev_formatter_prefs-46x75.png 46w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev_formatter_prefs-1x2.png 1w" sizes="auto, (max-width:767px) 349px, 349px" /></a></figure>



<p class="wp-block-paragraph">And here are the results after formatting the code once.</p>


<div class="jq-tabs tabs_wrapper tabs_horizontal"><ul><li><a href="#tab-6a7d48a51ca33-1">SQLDev 20.2 (patched)</a></li><li><a href="#tab-6a7d48a51ca33-2">SQLDev 20.2 (original)</a></li></ul><div id="tab-6a7d48a51ca33-1" ></p>
<p><a href="https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-patched.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10822" src="https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-patched.png" alt="" width="801" height="200" srcset="https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-patched.png 801w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-patched-300x75.png 300w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-patched-768x192.png 768w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-patched-260x65.png 260w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-patched-50x12.png 50w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-patched-150x37.png 150w" sizes="auto, (max-width:767px) 480px, (max-width:801px) 100vw, 801px" /></a></p>
<p></div><div id="tab-6a7d48a51ca33-2" ></p>
<p><a href="https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-original.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10824" src="https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-original.png" alt="" width="801" height="202" srcset="https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-original.png 801w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-original-300x76.png 300w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-original-768x194.png 768w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-original-260x66.png 260w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-original-50x13.png 50w, https://www.salvis.com/blog/wp-content/uploads/2020/11/sqldev-20.2-original-150x38.png 150w" sizes="auto, (max-width:767px) 480px, (max-width:801px) 100vw, 801px" /></a></p>
<p></div></div>



<p class="wp-block-paragraph">There are two significant improvements to the formatter. Both are related to comment and whitespace handling and therefore are independent of an Arbori program.</p>



<ul class="wp-block-list">
<li>The line of code after a comment is no longer indented additionally.</li>



<li>The line break after a single-line comment is no longer lost. As a result, the formatter will no longer comment out code.</li>
</ul>



<p class="wp-block-paragraph">While the first bug leads to badly formatted code, the second bug is really nasty. It breaks your code. This happens when you use single-line comments on consecutive lines. In most cases, this will lead to compile errors. However, I showed that the resulting code may be syntactically correct and a wrong formatting result could go unnoticed.</p>



<p class="wp-block-paragraph"><em>Updated on 2020-11-03, fixed typo in jar file names (<code>db-common...</code> to <code>dbtools-common...</code>).</em></p>



<p class="wp-block-paragraph"><em>Updated on 2020-11-05, added <code>SetServerOutput.class</code> to the patched jar file. Otherwise, no SQL can be processed in a worksheet. Mentioned an alternative option to embed the classes from the <code>guava.jar</code>. Renamed chapter &#8220;Overview&#8221; to &#8220;Solution Approach&#8221;.</em></p>
<p>The post <a href="https://www.salvis.com/blog/2020/11/01/patching-sql-developer-20-2-with-sqlcls-formatter/">Patching SQL Developer 20.2 with SQLcl&#8217;s Formatter</a> appeared first on <a href="https://www.salvis.com/blog">Philipp Salvisberg&#039;s Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.salvis.com/blog/2020/11/01/patching-sql-developer-20-2-with-sqlcls-formatter/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
