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 17:25:27 -0500, Gene Hubert
<110530.717_at_CompuServe.COM> 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.
>
>Gene Hubert
>Qualex Inc.
>Durham, NC
>
If you explicitly put the spaces in your insert statement, they will end up in the string... example:
SQL> create table temp (vvv varchar2(30));
Table created.
SQL> insert into temp values ('asdf ');
1 row created.
SQL> select '*'||vvv||'*' from temp;
'*'||VVV||'*'
If you don't want the data to end up in the database this way, you could create a trigger to automatically ltrim and rtrim... Received on Sat Dec 12 1998 - 21:50:04 CST