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

Home -> Community -> Usenet -> c.d.o.server -> Re: Pros and Cons of using Char and Varchar2

Re: Pros and Cons of using Char and Varchar2

From: Todd Gillespie <toddg_at_linux126.ma.utexas.edu>
Date: 6 Apr 2001 07:08:08 GMT
Message-ID: <9ajq0o$mcs$1@geraldo.cc.utexas.edu>

In comp.databases.oracle.tools Peter Shankey <shankeyp_at_its.charlestoncounty.org> wrote: : What are the issues why should I use one over the other.

Use the type that the attribute demands. If the attribute is defined as having a constant length, use CHAR - the constraint will help you find the bugs that arise when someone tries to insert variable length strings. If the attribute can have variable length, use VARCHAR. Other posters explained space savings, but from a purely modeling point of view, use a data type that matches the attribute.
As an aside, if you store var-length data in CHAR fields, you'll have to write code to trim whitespace padding. The code is not difficult, but you're moving type definition to an extra layer -- a fine source for subtle bugs. Received on Fri Apr 06 2001 - 02:08:08 CDT

Original text of this message

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