Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Just Define VARCHAR2 with Length of 2000 -Reply

Re: Just Define VARCHAR2 with Length of 2000 -Reply

From: Ian A. MacGregor <ian_at_SLAC.STANFORD.EDU>
Date: Tue, 6 Feb 1996 10:20:47 -0800
Message-Id: <9602062106.AA00132@alice.jcc.com>

>

> You are right (as far as I know). Oracle could
> care less whether your varchar2 is 20 or 2000
> bytes. As you say, the only reason to make them
> shorter is to enforce a specified length.

I'm not sure about this. The old limit of 255 was based on using 1 byte to store the length of a column entry. In order to store a length of 2000 you need 13 bits which won't fit into a single byte. If you declare a column varchar2(2000). I believe two bytes are automatically allocated to store the length.

Another reason to not go to 2000 character varchar2's is applications programming. Default display lengths are based on a column's definition in the database. Yes you can control this in these programs, but it means more work.

Finally a column definition of varchar2(2000) of what is in reality a "short" field invites people to cram two or more values into a single instance of the field. Not all fields can be protected via constraints nor triggers.

I'd reconsider useing varchar2(2000) for all your fields.

Ian MacGregor
Stanford Linear Accelerator Center
ian_at_slac.stanford.edu Received on Tue Feb 06 1996 - 16:06:09 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US