Re: CHAR vs VARCHAR2

From: Rod Fergusson <rod.fergusson_at_canada.attgis.com>
Date: 1995/06/11
Message-ID: <D9zr0B.GvI_at_ncrcan.canada.ncr.com>#1/1


Hi!  

In Oracle V7.x you have three choices;

(1) CHAR
(2) VARCHAR
(3) VARCHAR2
  You have to be very careful when evaluating the differences bewteen these alternatives. If you have recently upgraded from V6 of Oracle to V7 of Oracle... the CHAR datatypes are not synonymous. To follow is the explanation of each.  

ORACLE V6 (CHAR)                     
======================     
 
DEFn:                  Variable length character strings max   
                       length 255 char. 
 

COMPARISON SEMANTICS : Compares NON-PADDED CHAR Values  

SUPPORTED SYNONYMS : CHARACTER & VARCHAR     ORACLE V7 (CHAR)


 
DEFn:                  FIXED length strings of max 255 char. 
 

COMPARISON SEMANTICS : Compares BLANK-PADDED CHAR values.  

SUPPORTED SYNONYMS ; CHARACTER & VARCHAR

                       ***not equivalent to V6 CHAR datatype*** 
 
 

ORACLE V7 (VARCHAR)


 
Defn:                  Variable length char. strings of max 
                       length 2000 characters. 
 

COMPARISON SEMANTICS : Compares NON-PADDED VARCHAR2 values  

NOTE                 : NOT RECOMMENDED TO USE because in future 
                       releases of Oracle, the VARCHAR datatype 
                       may have different comparison semantics   
                       than that of VARCHAR2. 
 
 

ORACLE V7 (VARCHAR2)


 

All info is the same as for VARCHAR except that Oracle has assured us that the comparison semantics will remain the same as they are today.    


 

The big difference and problem that some people have run into with the CHAR vs. VARCHAR2 is in the evaluation of comparisons between these fields. One compares blank padded, and the other compares non-padded. It will depend on your applications, whether you would be affected by this or not.  

Hope this helps.... Sandra Fergusson Received on Sun Jun 11 1995 - 00:00:00 CEST

Original text of this message