Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> formatting output with SQL*Plus
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
Received on Wed Dec 08 2004 - 11:08:49 CST