<?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: Spool a CSV file from Oracle/ SQL*Plus without quotes</title>
	<atom:link href="http://luckylarry.co.uk/programming-tutorials/oracle/spool-a-csv-file-from-oracle-sqlplus-without-quotes/feed/" rel="self" type="application/rss+xml" />
	<link>http://luckylarry.co.uk/programming-tutorials/oracle/spool-a-csv-file-from-oracle-sqlplus-without-quotes/</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 14:19:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=449</generator>
	<item>
		<title>By: Peter</title>
		<link>http://luckylarry.co.uk/programming-tutorials/oracle/spool-a-csv-file-from-oracle-sqlplus-without-quotes/comment-page-1/#comment-7336</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Fri, 02 Dec 2011 15:27:54 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=236#comment-7336</guid>
		<description>Larry - this saved me so much time! Thanks.</description>
		<content:encoded><![CDATA[<p>Larry &#8211; this saved me so much time! Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dan</title>
		<link>http://luckylarry.co.uk/programming-tutorials/oracle/spool-a-csv-file-from-oracle-sqlplus-without-quotes/comment-page-1/#comment-7285</link>
		<dc:creator>dan</dc:creator>
		<pubDate>Thu, 01 Dec 2011 15:22:54 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=236#comment-7285</guid>
		<description>Thanks for the post
I created a sql script which captures the contents of various columns in a table that are going to be changed in a mass update routine.  The captured values are output in &quot;update&quot; statements so they can be used for recovery purpose&#039;s. There are going to be over 130,000 lines that will be built by this pre update capture script.  

I was going to run this script from toad and save it to a file, but the overhead of the Toad GUI was just not acceptable in the amount of time it took to run.  So, I was looking for a DOS/SQLPLUS solution.

This gave it to me.

Thanks</description>
		<content:encoded><![CDATA[<p>Thanks for the post<br />
I created a sql script which captures the contents of various columns in a table that are going to be changed in a mass update routine.  The captured values are output in &#8220;update&#8221; statements so they can be used for recovery purpose&#8217;s. There are going to be over 130,000 lines that will be built by this pre update capture script.  </p>
<p>I was going to run this script from toad and save it to a file, but the overhead of the Toad GUI was just not acceptable in the amount of time it took to run.  So, I was looking for a DOS/SQLPLUS solution.</p>
<p>This gave it to me.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: arich</title>
		<link>http://luckylarry.co.uk/programming-tutorials/oracle/spool-a-csv-file-from-oracle-sqlplus-without-quotes/comment-page-1/#comment-6490</link>
		<dc:creator>arich</dc:creator>
		<pubDate>Thu, 22 Sep 2011 09:17:58 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=236#comment-6490</guid>
		<description>Hi,

How can I run the spool script within a loop using a dynamic variable being used as the table name? Here, we have the table names in date format where every day a new table is created. So, to extract data from the respective date wise tables, I intend to call the spool script passing the parameter in the loop and generated the file for each date.

Could you please help me with the options urgently?</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>How can I run the spool script within a loop using a dynamic variable being used as the table name? Here, we have the table names in date format where every day a new table is created. So, to extract data from the respective date wise tables, I intend to call the spool script passing the parameter in the loop and generated the file for each date.</p>
<p>Could you please help me with the options urgently?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: raunak</title>
		<link>http://luckylarry.co.uk/programming-tutorials/oracle/spool-a-csv-file-from-oracle-sqlplus-without-quotes/comment-page-1/#comment-6324</link>
		<dc:creator>raunak</dc:creator>
		<pubDate>Thu, 04 Aug 2011 05:56:17 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=236#comment-6324</guid>
		<description>the code provide by you is not working please provide me with a technique to export a table from sql to .csv file format.</description>
		<content:encoded><![CDATA[<p>the code provide by you is not working please provide me with a technique to export a table from sql to .csv file format.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: larry</title>
		<link>http://luckylarry.co.uk/programming-tutorials/oracle/spool-a-csv-file-from-oracle-sqlplus-without-quotes/comment-page-1/#comment-5863</link>
		<dc:creator>larry</dc:creator>
		<pubDate>Fri, 08 Apr 2011 11:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=236#comment-5863</guid>
		<description>Spool will actually overwrite the file so no need to delete.</description>
		<content:encoded><![CDATA[<p>Spool will actually overwrite the file so no need to delete.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ajay</title>
		<link>http://luckylarry.co.uk/programming-tutorials/oracle/spool-a-csv-file-from-oracle-sqlplus-without-quotes/comment-page-1/#comment-5582</link>
		<dc:creator>ajay</dc:creator>
		<pubDate>Mon, 14 Feb 2011 11:01:33 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=236#comment-5582</guid>
		<description>I need to delete a file which I created using spool option. I need to recreate the same file again using spool command.
May I know the command for deleting the file.?

Thx
ajay</description>
		<content:encoded><![CDATA[<p>I need to delete a file which I created using spool option. I need to recreate the same file again using spool command.<br />
May I know the command for deleting the file.?</p>
<p>Thx<br />
ajay</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: larry</title>
		<link>http://luckylarry.co.uk/programming-tutorials/oracle/spool-a-csv-file-from-oracle-sqlplus-without-quotes/comment-page-1/#comment-941</link>
		<dc:creator>larry</dc:creator>
		<pubDate>Tue, 03 Nov 2009 23:14:18 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=236#comment-941</guid>
		<description>Glad it helped! :)</description>
		<content:encoded><![CDATA[<p>Glad it helped! <img src='http://luckylarry.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zAo</title>
		<link>http://luckylarry.co.uk/programming-tutorials/oracle/spool-a-csv-file-from-oracle-sqlplus-without-quotes/comment-page-1/#comment-939</link>
		<dc:creator>zAo</dc:creator>
		<pubDate>Tue, 03 Nov 2009 13:15:27 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=236#comment-939</guid>
		<description>Thanks! This is helpfull.</description>
		<content:encoded><![CDATA[<p>Thanks! This is helpfull.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: larry</title>
		<link>http://luckylarry.co.uk/programming-tutorials/oracle/spool-a-csv-file-from-oracle-sqlplus-without-quotes/comment-page-1/#comment-787</link>
		<dc:creator>larry</dc:creator>
		<pubDate>Tue, 22 Sep 2009 17:34:19 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=236#comment-787</guid>
		<description>Thanks James. Glad it helped you out and it&#039;s not just me! :) 

Interesting thing about the escape line and a good spot. I&#039;m going to add that in on all my variables although I&#039;ve not had the issue yet, but then I wouldn&#039;t like to have the problem either.</description>
		<content:encoded><![CDATA[<p>Thanks James. Glad it helped you out and it&#8217;s not just me! <img src='http://luckylarry.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>Interesting thing about the escape line and a good spot. I&#8217;m going to add that in on all my variables although I&#8217;ve not had the issue yet, but then I wouldn&#8217;t like to have the problem either.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://luckylarry.co.uk/programming-tutorials/oracle/spool-a-csv-file-from-oracle-sqlplus-without-quotes/comment-page-1/#comment-786</link>
		<dc:creator>James</dc:creator>
		<pubDate>Tue, 22 Sep 2009 16:47:04 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=236#comment-786</guid>
		<description>Nice post - proved very helpful for a report I needed to create.  Thanks!  Just something to add on your filename tip that I pulled from another source.  If you have the variable at the end of the filename (myFile_&amp;mydate.csv), you can end up with an odd name (myFile_&amp;mydate.csv.LST).  Something about SQL Plus not knowing where the variable ends.  To fix this, you need to include an escape character at the end of the variable name.  
&lt;code&gt;
set escape /
SET linesize 160;

COLUMN dcol new_value mydate noprint
SELECT to_char(sysdate,&#039;YYYYMMDD&#039;) dcol FROM dual;
spool c:\temp\myFile_&amp;mydate/.csv
set escape off;

SELECT &#039;Field1Name,Field2Name,Field3Name,Field4Name,Field5Name&#039; FROM dual;
&lt;/code&gt;

Any character works for the escape that you aren&#039;t using between where you set the escape and set it off.  The slash worked for me, but I had to set escape off after the spool command as I was using it in my query.

Thanks again!</description>
		<content:encoded><![CDATA[<p>Nice post &#8211; proved very helpful for a report I needed to create.  Thanks!  Just something to add on your filename tip that I pulled from another source.  If you have the variable at the end of the filename (myFile_&amp;mydate.csv), you can end up with an odd name (myFile_&amp;mydate.csv.LST).  Something about SQL Plus not knowing where the variable ends.  To fix this, you need to include an escape character at the end of the variable name.<br />
<code><br />
set escape /<br />
SET linesize 160;</p>
<p>COLUMN dcol new_value mydate noprint<br />
SELECT to_char(sysdate,'YYYYMMDD') dcol FROM dual;<br />
spool c:\temp\myFile_&amp;mydate/.csv<br />
set escape off;</p>
<p>SELECT 'Field1Name,Field2Name,Field3Name,Field4Name,Field5Name' FROM dual;<br />
</code></p>
<p>Any character works for the escape that you aren&#8217;t using between where you set the escape and set it off.  The slash worked for me, but I had to set escape off after the spool command as I was using it in my query.</p>
<p>Thanks again!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

