<?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>string quotation &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/string-quotation/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Sat, 03 Sep 2016 07:52:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>PostgreSQL: Why we should use &#8216;$$&#8217; double dollar in PG/pgSQL Block</title>
		<link>https://www.dbrnd.com/2016/09/postgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes/</link>
					<comments>https://www.dbrnd.com/2016/09/postgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 03 Sep 2016 07:52:39 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[$$ double dollar]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[single quote]]></category>
		<category><![CDATA[string quotation]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3575</guid>

					<description><![CDATA[Actually, The funda of $$ &#8211; double dollar is very simple, but Postgres new comers have always doubted about it. When you are writing a PL/pgSQL function, the body of the function has to pass in the form of a string literal. For example: Create a sample table: [crayon-6ab55f04e2d42719815612/] Create a function without $$ &#8211; [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fpostgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes%2F&amp;linkname=PostgreSQL%3A%20Why%20we%20should%20use%20%E2%80%98%24%24%E2%80%99%20double%20dollar%20in%20PG%2FpgSQL%20Block" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fpostgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes%2F&amp;linkname=PostgreSQL%3A%20Why%20we%20should%20use%20%E2%80%98%24%24%E2%80%99%20double%20dollar%20in%20PG%2FpgSQL%20Block" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fpostgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes%2F&amp;linkname=PostgreSQL%3A%20Why%20we%20should%20use%20%E2%80%98%24%24%E2%80%99%20double%20dollar%20in%20PG%2FpgSQL%20Block" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fpostgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes%2F&amp;linkname=PostgreSQL%3A%20Why%20we%20should%20use%20%E2%80%98%24%24%E2%80%99%20double%20dollar%20in%20PG%2FpgSQL%20Block" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fpostgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes%2F&amp;linkname=PostgreSQL%3A%20Why%20we%20should%20use%20%E2%80%98%24%24%E2%80%99%20double%20dollar%20in%20PG%2FpgSQL%20Block" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fpostgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes%2F&amp;linkname=PostgreSQL%3A%20Why%20we%20should%20use%20%E2%80%98%24%24%E2%80%99%20double%20dollar%20in%20PG%2FpgSQL%20Block" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fpostgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes%2F&#038;title=PostgreSQL%3A%20Why%20we%20should%20use%20%E2%80%98%24%24%E2%80%99%20double%20dollar%20in%20PG%2FpgSQL%20Block" data-a2a-url="https://www.dbrnd.com/2016/09/postgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes/" data-a2a-title="PostgreSQL: Why we should use ‘$$’ double dollar in PG/pgSQL Block"></a></p><p>Actually, The funda of $$ &#8211; double dollar is very simple, but Postgres new comers have always doubted about it. </p>
<p>When you are writing a PL/pgSQL function, the body of the function has to pass in the form of a string literal. </p>
<p><strong>For example:</strong></p>
<p><strong>Create a sample table:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Students 
(StudID INT, StudName CHARACTER VARYING);</pre> </p>
<p><strong>Create a function without $$ &#8211; double dollar:</strong></p>
<pre class="crayon-plain-tag">CREATE OR REPLACE FUNCTION fn_TestDelimiter()
RETURNS BOOLEAN AS
'
BEGIN  
	INSERT INTO tbl_Students VALUES (1,''Anvesh'');
	RETURN TRUE; 
END;
'
LANGUAGE plpgsql</pre> </p>
<blockquote><p>We can create a function using single quote and We do not require $$ &#8211; double dollar in above example.<br />
But we should not do this, because It is not suggestible to write your function code in single quotes. </p></blockquote>
<blockquote><p>When you create your function using single quote, you have to escape all internal single quote in the body.
</p></blockquote>
<p><strong>$$ &#8211; Double Dollar:</strong> </p>
<blockquote><p>It is nothing, but just a substitute of a single quote. Using $$ &#8211; Double Dollar we can avoid all types of quoting issues.<br />
We can also put token between $$ Double Dollar like: $rnd$ which makes it unique. </p></blockquote>
<p><strong>For Example:<br />
Create a function with $$ &#8211; double dollar:</strong></p>
<pre class="crayon-plain-tag">CREATE OR REPLACE FUNCTION fn_TestDelimiter()
RETURNS BOOLEAN AS
$$
BEGIN  
	INSERT INTO tbl_Students VALUES (1,'Anvesh');
	RETURN TRUE; 
END;
$$
LANGUAGE plpgsql</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/09/postgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
