How to remove spaces in data spooled from database

I am trying to spool a simple select statement to a text file.  The problem I am running into is that additional spaces get added  my data.  For eg

set pages 0;
set echo off;
set trim on;
set linesize 250;
set trims on;
set heading off;
set space 0;

select 'KIT-' || trim(field1) || '-' || trim(field2) || '-PACK' as data from table
where trim(field3)='xxx'
order by field1;

spool off;

My data should be

However, I am getting
K I T - d a t a 1 - d a t a 2 - P A C K

Please help
Dianna ChuaAsked:
Who is Participating?
Nitin SontakkeDeveloperCommented:
Looks like a DBCS (Double Byte Character System) problem to me. I obviously don't know the answer from Oracle perspective.

Is your data-type by any change nvarchar (in Microsoft SQL Server parlance!)? If yes, could you try convert it to varchar and then try, may be!
Dianna ChuaAuthor Commented:
Thanks!  Never thought of that!

My data-type is NCHAR in Oracle.  Worked after I converted it to CHAR.
Nitin SontakkeDeveloperCommented:
Might as well formally close the question.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.