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

Home -> Community -> Usenet -> c.d.o.misc -> Re: formatting output with SQL*Plus

Re: formatting output with SQL*Plus

From: Alan <alan_at_erols.com>
Date: Wed, 8 Dec 2004 14:22:47 -0500
Message-ID: <31p2k8F3ebv5oU1@individual.net>

"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
>

SELECT column1||'|'||column2 etc...

Get rid of SET COLSEP Received on Wed Dec 08 2004 - 13:22:47 CST

Original text of this message

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