|Export to CSV issue [message #192451]
||Tue, 12 September 2006 08:02
Registered: September 2006
Location: Leicester, UK
I'm having a problem with a little script I am writing in SQLPlus. I have a fair bit of experience with MS SQL, but am having an issue with converting to Oracle!
Basically, I need to extract data using a sql script into a CSV File. To do this, I have the following script:
set echo off heading off feedback off
set newpage 0
set pagesize 0
set linesize 1000
set trimspool on
set space 0
SELECT DISTINCT rtrim(custrec.custNo,) as CustNum,
ORDER BY CustNum ASC
I run this from the DOS command line using a scheduler.
My problem is that the first data field is padded, so the output I get in the csv file is like this:
(The _'s are actually spaces, but I can't seem to post extraneous spaces!)
Whereas I need to to be like this:
without the spaces
Also, the outputted csv appears to have an extra line break at the end of the file.