This is a varchar2(60) field which has extra spaces at the end.

length(fieldname) = length(rtrim(fieldname))

substr(fieldname,1,length(fieldname)) displays spaces (visible on toad and in an unix file)

substr(fieldname,1,30) displays 30 chars only. (field ends at the last char in toad as well as unix)

length(fieldname) = 30

Let's say a field's name is Functionname and it's values are:

OracleProgramming
OracleplsqlProgramming


substr(fieldname,1,length(fieldname)) shows something like this on toad:

OracleProgramming |
OracleplsqlProgramming |

and substr(functionname,1,22) on toad shows:

OracleProgramming |
OracleplsqlProgramming|

Here length(OracleplsqlProgramming) = 22

It's the same on an unix file. I can see the spaces( or nulls ??) In unix file, the line splits ....The unix file is created from a shell script. When I substring the fieldname to its length (Ex: 30) it displays normally on unix file. If I don't substring or substring it to length(fieldname), those blanks/nulls/extra chars appear, therefore splitting the line into two seperate lines on unix file

TRIMSPOOL is already ON