Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: VARCHAR2 and trailing spaces - what's going on!
Hi Dnh,
Best way is to look and see ;)
SQL> create table bowie_varchar2_test (ziggy varchar2(30));
Table created.
SQL> insert into bowie_varchar2_test values ('Bowie');
1 row created.
SQL> insert into bowie_varchar2_test values ('Bowie ');
1 row created.
SQL> insert into bowie_varchar2_test values (' Bowie ');
1 row created.
SQL> commit;
Commit complete.
SQL> select dump(ziggy) from bowie_varchar2_test;
DUMP(ZIGGY)
Typ=1 Len=5: 66,111,119,105,101 Typ=1 Len=10: 66,111,119,105,101,32,32,32,32,32 Typ=1 Len=15: 32,32,32,32,32,66,111,119,105,101,32,32,32,32,32
SQL> A VARCHAR2 field is variable in length and will only store those details as specified (including leading and trailing spaces).
Cheers
Richard
"dnh" <nigel.hurst_at_food.ds-s.com> wrote in message
news:3d982155.5881984_at_139.121.16.43...
> Now then
>
> I have always thought that when you insert a string into a varchar2
> column any trailing spaces would be stripped off but am discovering
> that this is not so.
>
> being a child of the net I then did a quick search to find both
> situations described as true - it does strip trailing spaces and it
> doesn't !!!!!!
>
> I'm so confused and , well, confused - what is the truth, somebody
> help.
>
> cheers
> nigel
> -------------------------------------------------
> Take out food to reply to nigel.hurst_at_food.ds-s.com
> -------------------------------------------------
Received on Mon Sep 30 2002 - 05:34:15 CDT