<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	
	>
<channel>
	<title>
	Comments on: Formatting SQL Scripts in a Directory Tree with SQLcl	</title>
	<atom:link href="https://www.salvis.com/blog/2020/08/09/formatting-sql-scripts-in-a-directory-tree-with-sqlcl/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.salvis.com/blog/2020/08/09/formatting-sql-scripts-in-a-directory-tree-with-sqlcl/</link>
	<description>Database-centric development</description>
	<lastBuildDate>Sun, 12 Nov 2023 12:51:37 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
<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/2020/08/09/formatting-sql-scripts-in-a-directory-tree-with-sqlcl/feed/"/>
	<item>
		<title>
		By: Philipp Salvisberg		</title>
		<link>https://www.salvis.com/blog/2020/08/09/formatting-sql-scripts-in-a-directory-tree-with-sqlcl/#comment-21806</link>

		<dc:creator><![CDATA[Philipp Salvisberg]]></dc:creator>
		<pubDate>Mon, 10 Aug 2020 08:58:27 +0000</pubDate>
		<guid isPermaLink="false">https://www.salvis.com/blog/?p=10395#comment-21806</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.salvis.com/blog/2020/08/09/formatting-sql-scripts-in-a-directory-tree-with-sqlcl/#comment-21800&quot;&gt;Micke Vrolijk&lt;/a&gt;.

Hi Micke,

Thanks.

&lt;blockquote&gt;Do you have any experience with the combination of triggering these kindes of directory formats from a Git hook? (eg. pre-commit?).&lt;/blockquote&gt;
We are discussing this with customers (early stages). I have not tried it, but I do not see a problem since the pre-commit hook is just a shell script. This &lt;a href=&quot;https://github.com/michalrus/git-hooks-code-autoformat&quot; rel=&quot;nofollow ugc&quot;&gt;GitHub repo&lt;/a&gt; has some examples for other languages. This solution relies on other tools (for PL/SQL this would be SQLcl, the JavaScript plus settings) and everything is included in the repo (which has pros and cons).

So, technically this is for sure doable. Of course you need SQLcl and a JavaScript. However, I guess that agreeing on a code style and living with the imperfection of a formatter is another story. 

Please let me know, when managed to integrate it. Thank you.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.salvis.com/blog/2020/08/09/formatting-sql-scripts-in-a-directory-tree-with-sqlcl/#comment-21800">Micke Vrolijk</a>.</p>
<p>Hi Micke,</p>
<p>Thanks.</p>
<blockquote><p>Do you have any experience with the combination of triggering these kindes of directory formats from a Git hook? (eg. pre-commit?).</p></blockquote>
<p>We are discussing this with customers (early stages). I have not tried it, but I do not see a problem since the pre-commit hook is just a shell script. This <a href="https://github.com/michalrus/git-hooks-code-autoformat" rel="nofollow ugc">GitHub repo</a> has some examples for other languages. This solution relies on other tools (for PL/SQL this would be SQLcl, the JavaScript plus settings) and everything is included in the repo (which has pros and cons).</p>
<p>So, technically this is for sure doable. Of course you need SQLcl and a JavaScript. However, I guess that agreeing on a code style and living with the imperfection of a formatter is another story. </p>
<p>Please let me know, when managed to integrate it. Thank you.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Micke Vrolijk		</title>
		<link>https://www.salvis.com/blog/2020/08/09/formatting-sql-scripts-in-a-directory-tree-with-sqlcl/#comment-21800</link>

		<dc:creator><![CDATA[Micke Vrolijk]]></dc:creator>
		<pubDate>Mon, 10 Aug 2020 08:23:36 +0000</pubDate>
		<guid isPermaLink="false">https://www.salvis.com/blog/?p=10395#comment-21800</guid>

					<description><![CDATA[Hi Philipp,

Excellent post on formatting! Do you have any experience with the combination of triggering these kindes of directory formats from a Git hook? (eg. pre-commit?).

I am looking to a way to enforce a standardized formatting of the (pl)sql files in the team in a way that we don&#039;t need to rely on a specific tool with specific settings.]]></description>
			<content:encoded><![CDATA[<p>Hi Philipp,</p>
<p>Excellent post on formatting! Do you have any experience with the combination of triggering these kindes of directory formats from a Git hook? (eg. pre-commit?).</p>
<p>I am looking to a way to enforce a standardized formatting of the (pl)sql files in the team in a way that we don&#8217;t need to rely on a specific tool with specific settings.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Philipp Salvisberg		</title>
		<link>https://www.salvis.com/blog/2020/08/09/formatting-sql-scripts-in-a-directory-tree-with-sqlcl/#comment-21794</link>

		<dc:creator><![CDATA[Philipp Salvisberg]]></dc:creator>
		<pubDate>Mon, 10 Aug 2020 07:43:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.salvis.com/blog/?p=10395#comment-21794</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.salvis.com/blog/2020/08/09/formatting-sql-scripts-in-a-directory-tree-with-sqlcl/#comment-21780&quot;&gt;Torsten Kleiber&lt;/a&gt;.

Hi Torsten,

😲 I completely forgot about the &lt;a href=&quot;https://docs.oracle.com/en/database/oracle/sql-developer/20.2/rptug/sql-developer-concepts-usage.html#GUID-6F4050CA-8ECC-4FC1-B5D9-CA8684391CB7&quot; rel=&quot;nofollow ugc&quot;&gt;sdcli&lt;/a&gt; and did not know that you can format files with it.

A good opportunity to run it from my sandbox source directory.
 
&lt;pre class=&quot;lang:default decode:true &quot; title=&quot;sdcli: Formatting example files&quot;&gt;bash /Applications/SQLDeveloper20.2.0.app/Contents/Resources/sqldeveloper/sqldeveloper/bin/sdcli format input=. output=.

 Oracle SQL Developer
 Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.

Warning: Nashorn engine is planned to be removed from a future JDK release
Command Completed.&lt;/pre&gt; 

Then I checked the result. All files were formatted based on my settings within SQL Developer. All .sql files and the .js file too. So I probably have to call the cli per file, which might be a bit slow.

Now Let&#039;s run it for the utPLSQL code (as in the video):
 
&lt;pre class=&quot;lang:default decode:true &quot; title=&quot;sdcli: Formatting utPLSQL source code&quot;&gt;bash /Applications/SQLDeveloper20.2.0.app/Contents/Resources/sqldeveloper/sqldeveloper/bin/sdcli format input=utplsql/source output=utplsql/source

 Oracle SQL Developer
 Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.

Warning: Nashorn engine is planned to be removed from a future JDK release
Command Completed.&lt;/pre&gt; 

The console output is a bit sparse, but behind the scenes all 297 files in the directory tree have been formatted with my SQL Developer settings. 

So, after trying it, I&#039;d say you may use the sdcli to format your code, when you are sure that your directories contain only files to be formatted. If you want to have more control (file extensions to consider, handling files with syntax errors, console output) then a JavaScript for SQLcl might be a good alternative. Furthermore the SQLcl is more compact and might be better suited to run on servers.

Thank you very much for your comment Torsten. I&#039;ve learnt something new. ]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.salvis.com/blog/2020/08/09/formatting-sql-scripts-in-a-directory-tree-with-sqlcl/#comment-21780">Torsten Kleiber</a>.</p>
<p>Hi Torsten,</p>
<p>😲 I completely forgot about the <a href="https://docs.oracle.com/en/database/oracle/sql-developer/20.2/rptug/sql-developer-concepts-usage.html#GUID-6F4050CA-8ECC-4FC1-B5D9-CA8684391CB7" rel="nofollow ugc">sdcli</a> and did not know that you can format files with it.</p>
<p>A good opportunity to run it from my sandbox source directory.</p>
<pre class="lang:default decode:true " title="sdcli: Formatting example files">bash /Applications/SQLDeveloper20.2.0.app/Contents/Resources/sqldeveloper/sqldeveloper/bin/sdcli format input=. output=.

 Oracle SQL Developer
 Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.

Warning: Nashorn engine is planned to be removed from a future JDK release
Command Completed.</pre>
<p>Then I checked the result. All files were formatted based on my settings within SQL Developer. All .sql files and the .js file too. So I probably have to call the cli per file, which might be a bit slow.</p>
<p>Now Let&#8217;s run it for the utPLSQL code (as in the video):</p>
<pre class="lang:default decode:true " title="sdcli: Formatting utPLSQL source code">bash /Applications/SQLDeveloper20.2.0.app/Contents/Resources/sqldeveloper/sqldeveloper/bin/sdcli format input=utplsql/source output=utplsql/source

 Oracle SQL Developer
 Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.

Warning: Nashorn engine is planned to be removed from a future JDK release
Command Completed.</pre>
<p>The console output is a bit sparse, but behind the scenes all 297 files in the directory tree have been formatted with my SQL Developer settings. </p>
<p>So, after trying it, I&#8217;d say you may use the sdcli to format your code, when you are sure that your directories contain only files to be formatted. If you want to have more control (file extensions to consider, handling files with syntax errors, console output) then a JavaScript for SQLcl might be a good alternative. Furthermore the SQLcl is more compact and might be better suited to run on servers.</p>
<p>Thank you very much for your comment Torsten. I&#8217;ve learnt something new. </p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
