Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: formatting output with SQL*Plus
"Thomas Kellerer" <NNGNVRDSJEBN_at_spammotel.com> wrote in message news:31oqp1F3d2fp2U1_at_individual.net...
> Hello,
>
> I'm hitting the old problem that I need to spool data into a text file, but
> SQL*Plus insists on padding the fields to the length of the column definition.
>
> The problem is that I cannot concatenate the columns as I get an "ORA-01489:
> result of string concatenation is too long" when doing so.
>
> What I want is a file that has the following format
>
> value1|value2|value3
>
> but what I get is:
>
> value1 |value2 |value3
>
> The columns are all VARCHAR2(2000)
>
> What I'm basically doing is:
>
> set term off
> set echo off
> set feedback off
> set heading off
> set define off
> set timing off
> set linesize 32767
> set pagesize 0
> set colsep '|'
> set newpage none
> set trimspool on
>
> spool output.txt
>
> SELECT column1,column2, column3
> FROM my_table;
>
> spool off
>
> Is there any way to remove the trailing spaces in the column values?
>
> I'm using Oracle 8.1.7.4.0 on HP/UX
>
> Any input is greatly appreciated!!
>
> Cheers
> Thomas
>
http://asktom.oracle.com/pls/ask/f?p=4950:8:12466981671588140497::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:1197835631433 Received on Fri Dec 10 2004 - 17:56:36 CST