Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL*PLUS spooling and CR/LF
Since you are in Windows (presumably running either the DOS or the Windows
sqlplus client) you will automatically get a carriage return and line feed at a
binary level. As long as you use the file on the Windows platform you will be
ok. It is only if you transfer the file to another system (UNIX, mainframe, etc)
that you'll see a difference. In that case it is the responsibility of the
transfer protocol to do any upfix to the records.
Is there any specific reason why you need the cr/lf sequence? Once you create the data file, what do you do with it?
Also, it looks like you are trying to create a file with quoted strings. you'd be better off if you did it like this:
select '"'||a.frt_order||'"'
from frt.freight
where (frt_mode = 'U' or frt_mode = 'u' or frt_mode = 'C'
or frt_mode = 'c');
Ken
abrusko wrote:
> I am in a Windows 95 environment, using SQL*PLUS to access
> Oracle. I'm not sure what OS Oracle is running on, but I
> want to use SQL*PLUS to execute a query to "Spool" the
> results to a text file.
>
> A version of the Query is below (I took out all of the
> columns except one so as not to waste space here):
>
> spo c:\freightproject\spool\FrtEdi;
> set termout off;
> set newpage 0;
> set space 0;
> set linesize 999;
> set pagesize 0;
> set echo off;
> set feedback off;
> set heading off;
> select '"', a.frt_order, '"'
> from frt.freight
> where (frt_mode = 'U' or frt_mode = 'u' or frt_mode = 'C'
> or frt_mode = 'c');
> spo off;
> rem remove the following lines for production
> set termout on;
> set newpage 1;
> set space 1;
> set linesize 100;
> set pagesize 24;
> set echo off;
> set feedback 6;
> set heading on;
>
> I would like for there to be a CR/LF at the end of each
> line following frt_order.