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:Spooling variable length records

Re:Spooling variable length records

From: Vinay Joshi <vjoshi_at_pinnacle.co.uk>
Date: 1998/01/22
Message-ID: <717BDE76D864D011870F00A0C9283F1E1056B2@exchange.pinnacle.co.uk>#1/1

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 Thu Jan 22 1998 - 00:00:00 CST

Original text of this message

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