Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Trailing Spaces on VARCHAR2 Data
On Fri, 11 Dec 1998, Gene Hubert wrote:
> I'm running Oracle 8.0.3 on NT 4.0.
>
> I occasionally run across data in varchar2 columns that has
> trailing spaces. Comparisons on this data will fail without an
> rtrim or adding the right number of spaces to what is being
> compared. Can anyone explain how varchar2 data ends up with
> trailing spaces? I thouhgt this was not possbile.
>
Hi Gene.
VARCHAR2 is a variable length character type (unlike CHAR, which is
fixed). What may be happening (I'm not 100 % sure) is if you're inserting
data that's has spaces on the end, it will become part of data for that
row.
I don't think that VARCHAR2 automattically strips spaces. I vaguely recall having problems cos of this in the past. Make sure the data going in is 'clean', or strip it afterwords.
Hope this helps...