Removing final carriage return from spooled output [message #468301] |
Thu, 29 July 2010 10:24 |
strauss_jon
Messages: 8 Registered: December 2007 Location: Whyteleafe
|
Junior Member |
|
|
Hi there
I'm going potty with this, such a seemingly simple thing but can't get round it.
I spool an output using the following script and get a final carriage return at the end. This fails our SSIS bulk insert task. How do i get rid of this carriage return please? Sample below:
SET SPACE 0
SET HEAD OFF
SET FEEDBACK OFF
SET TERMOUT OFF
set echo off
set newpage 0
set space 0
set pagesize 0
set feedback off
set trimspool on
set heading off
set linesize 15000
SET TRIMOUT ON
SPOOL "outputFile.spl"
SELECT STATEMENT HERE;
spool off
exit
Thanks in advance! Jon
|
|
|
|
Re: Removing final carriage return from spooled output [message #468309 is a reply to message #468301] |
Thu, 29 July 2010 11:35 |
|
LKBrwn_DBA
Messages: 487 Registered: July 2003 Location: WPB, FL
|
Senior Member |
|
|
strauss_jon wrote on Thu, 29 July 2010 11:24... Blah, blah, blah ...
... How do i get rid of this carriage return please?
If you get rid of the carriage return, how will you distinguish each record (record terminator character's)? The spool file you are creating may have VARIABLE length records (depending on our query) using the carriage return to separate (terminate) them "SET TRIMSPOOL ON" did that.
Here are your options:
1) Generate FIXED length records "SET LIN {nnn} TRIMS OFF" and include the CR as a one or two character field (depending on WinDoze or Unix) at the end of the record in the SSIS definition.
2) Use UTL_FILE package to create the file.
[Updated on: Thu, 29 July 2010 11:51] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|
Re: Removing final carriage return from spooled output [message #468474 is a reply to message #468301] |
Fri, 30 July 2010 03:25 |
strauss_jon
Messages: 8 Registered: December 2007 Location: Whyteleafe
|
Junior Member |
|
|
Nah, don't think it can be done easily without scripting the action. Can't believe SSIS's load component can't handle this. Anyway, there's alternatives in SSIS so i'll try others. Was just hoping there would be an Oracle set option (or something similar) which could sort this out.
Thanks for your posts anyway. Cheers, Jon
|
|
|
|
|
Re: Removing final carriage return from spooled output [message #468550 is a reply to message #468343] |
Fri, 30 July 2010 11:15 |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
LKBrwn_DBA wrote on Thu, 29 July 2010 22:18Unless the OP's server is WinDoze, I tested in Unix and get no "empty" rows (CR) at the end of the file.
Unix' line terminators are LF, not CR.
If you feel you should display your supremacy by using "windoze" instead of windows, at least make sure you got your unix right.
|
|
|
Re: Removing final carriage return from spooled output [message #468961 is a reply to message #468550] |
Mon, 02 August 2010 12:01 |
|
LKBrwn_DBA
Messages: 487 Registered: July 2003 Location: WPB, FL
|
Senior Member |
|
|
Frank wrote on Fri, 30 July 2010 12:15
Unix' line terminators are LF, not CR.
If you feel you should display your supremacy by using "windoze" instead of windows, at least make sure you got your unix right.
Yep, you got me there with the CR part.
On the other hand, It's not "supremacy", but the undeniable fact is that Microsoft OS take a very long time to load (compared to other OS's) and therefore one may "doze off" while waiting...therefore "WinDoze" is an appropriate moniker for this OS.
[Updated on: Wed, 04 August 2010 06:40] by Moderator Report message to a moderator
|
|
|