Home » Other » Training & Certification » flat file output with trailing blanks
flat file output with trailing blanks [message #288824] Tue, 18 December 2007 17:32 Go to next message
ottsompol
Messages: 9
Registered: December 2007
Junior Member
Hi,
I am exporting to a fixed-width data file. The format calls for the last 5 positions to be blanks. Looks like SQL drops the trailing empty string. please help.


current result:
1234456
1233455
1234554

desire result:

1234456(5spaces)
1233455(5spaces)
1234554(5spaces)
Re: flat file output with trailing blanks [message #288844 is a reply to message #288824] Tue, 18 December 2007 22:14 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9088
Registered: November 2002
Location: California, USA
Senior Member
"Exporting?" Using an import/export utility? Or just spooling? If you are just spooling to a flat file from SQL*Plus, then:

SET TRIM OFF
SET TRIMSPOOL OFF

as explained in the documentation excerpts below.

SET TRIM[OUT] {ON | OFF}

Determines whether SQL*Plus puts trailing blanks at the end of each displayed line. ON removes blanks at the end of each line, improving performance especially when you access SQL*Plus from a slow communications device. OFF enables SQL*Plus to display trailing blanks. TRIMOUT ON does not affect spooled output.


SET TRIMS[POOL] {ON | OFF}

Determines whether SQL*Plus puts trailing blanks at the end of each spooled line. ON removes blanks at the end of each line. OFF enables SQL*Plus to include trailing blanks. TRIMSPOOL ON does not affect terminal output.
icon10.gif  Re: flat file output with trailing blanks [message #289438 is a reply to message #288844] Fri, 21 December 2007 12:30 Go to previous message
ottsompol
Messages: 9
Registered: December 2007
Junior Member
Thank you Barbara for directing me to the solution. I set the linesize to the width of the flat file specification and set trimspool on and it came out exactly the way I need it.
Previous Topic: creating new database
Next Topic: Fixed Assets (merged 2 threads)
Goto Forum:
  


Current Time: Thu Apr 18 07:16:27 CDT 2024