Re: VARCHAR2 vs. CHAR

From: Don Granaman <granaman_at_mail.phonet.com>
Date: 1996/11/20
Message-ID: <57693f$e9q_at_iorich.phonet.com>#1/1


In article <32948023.1CFB_at_econnect.ca>, Yudong Sun <ysun_at_econnect.ca> wrote:
>How efficient is VARCHAR2's implementation?
>Would I have a reason to prefer the use of CHAR for things like
>a person name (e.g., CHAR(50))? (I would use VARCHAR2 for things
>like file path - e.g. VARCHAR2(256).)
>
>Thanks a lot,
>
>Yudong

Efficient in what respect? Storage only? Varchar2 (up to 255(?) bytes) stores a length byte, and the actual data. Over 255(?) bytes it uses 3 bytes for the length. Char is fixed length. Hence, storing "JOHN SMITH" as a varchar(50) uses 11 bytes. Storing it as a char uses 51 bytes. Received on Wed Nov 20 1996 - 00:00:00 CET

Original text of this message