Leading spaces in a spooled select

From: <snarks_at_gmail.com>
Date: Fri, 07 Sep 2007 11:04:51 -0000
Message-ID: <1189163091.685313.45940_at_50g2000hsm.googlegroups.com>



Here's my SQL*Plus program:

SET SPACE 0
SET LINESIZE 4000
SET TRIMSPOOL ON
[Quoted] -- This must be a single 'tab' character, not a space SET COLSEP ' '
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET VERIFY OFF
SET HEADING OFF
SET MARKUP HTML OFF SPOOL OFF
SET SERVEROUTPUT ON
SET TERMOUT OFF
SPOOL Output.txt
SELECT numeric_field

     , character_field
  FROM data_source;

What I want is a tab-separated text file. The problem is that the numeric field ends up with leading spaces. I've tried SELECT TRIM(numeric_field) but then it just ends up with a load of trailing spaces, which is odd. I'm getting around it by using the || operator to concatenate the tabs manually. How do I get rid of the leading and/ or trailing spaces on the first field?

Phil Hibbs. Received on Fri Sep 07 2007 - 13:04:51 CEST

Original text of this message