Re: Do I need to create a field type LONG?

From: Galina <galkas_at_mail.ru>
Date: 10 May 2004 01:09:01 -0700
Message-ID: <ecdc865.0405100009.6e4e88a9_at_posting.google.com>


Thank you., especially for taking your time to explain the difference with the example. Not that I see a need for fixed length string at the moment, but I am sure in some situations it would be needed. Galina
sharkdba_at_yahoo.com (Sharkie) wrote in message news:<423b5ab1.0405071248.10c736a1_at_posting.google.com>...
> galkas_at_mail.ru (Galina) wrote in message news:<ecdc865.0405052359.1dd8e62b_at_posting.google.com>...
> > Hi Jim
> > Thank you for your answer. Of course, it should be this way. Any
> > respectable database stores strings allocating disk space as much as
> > necessary and not more.
>
> That's why it's called varchar ==> variable character length.
> char data type on the other hand will pad your string up to specified
> length, see example:
>
> SQL> create table temp (varname varchar2(20), fixname char(20));
> Table created.
>
> SQL> insert into temp values ('short string', 'short string');
> 1 row created.
>
> SQL> insert into temp values ('longer string', 'longer string');
> 1 row created.
>
> SQL> select '|'||varname||'|' "varname" from temp;
>
> varname
> ----------------------
> |short string|
> |longer string|
>
> SQL> select '|'||fixname||'|' "fixname" from temp;
>
> fixname
> ----------------------
> |short string |
> |longer string |
Received on Mon May 10 2004 - 10:09:01 CEST

Original text of this message