Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Re:Spooling variable length records

Re: Re:Spooling variable length records

From: Adrian Shepherd <Adrian.Shepherd_at_BTINTERNET.COM>
Date: 1998/01/25
Message-ID: <6afht1$2v6$1@uranium.btinternet.com>#1/1

The reverse of this is to create fixed record lengths by using LPAD....

Vinay Joshi wrote in message
<717BDE76D864D011870F00A0C9283F1E1056B2_at_exchange.pinnacle.co.uk>...
>There is!
>Use 2 functions
>LTRIM - For trimming from left and
>RTRIM - For trimming from right
>
>an e.g. would be
>select rtrim(ltrim(field1||' '||field2||' '||field3.....) from tablename
>etc....
>
>This would trim your output (a record or a row) from both left and
>right.
>
>Hope this helps.
>Oracle DBA/Support
>Vinay Joshi
>Pinnacle Insurance Plc
>
>> -----Original Message-----
>> From: jselby_at_cams.co.uk (Jason Selby) [SMTP:jselby_at_cams.co.uk]
>> Posted At: 22 January 1998 16:29
>> Posted To: server
>> Conversation: Spooling variable length records
>> Subject: Spooling variable length records
>>
>> Here's the thing, I have an aplication which needs to output variable
>> length
>> ASCII text files from ORACLE tables.
>>
>> To do this I use SQLPLUS and have a script which does something like
>>
>> set heading off
>> set feedback off
>> etc
>> set linesize 200
>> spool file1.txt
>> select field1||'|'||field2 etc..
>> from tab1;
>> spool off
>>
>> My problem is that most of the files I create have variable length
>> records
>> which means that each record has a load of trailing spaces on it.
>> This has to
>> be stripped off by a seperate routine.
>>
>> Is there any way to get ORACLE to output an ASCII file and trim off
>> extra
>> spaces at the same time.
>>
>> Many thanks
>>
>>
>> Jason
>
Received on Sun Jan 25 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US