Sem 3‎ > ‎DBMS (SQL) LAB‎ > ‎

Common : Varchar, Varchar2, Char

posted Aug 7, 2011, 12:55 AM by Neil Mathew   [ updated Aug 7, 2011, 1:02 AM ]

Basic Difference between the three:

CHAR(5) is fixed length, right padded with spaces.

VARCHAR(5) is fixed length, right padded with null

VARCHAR2(5) is variable length. (Oracle)

( But, remember CHAR is faster than VARCHAR - some times up to 50% faster. )

Difference between Varchar & Varchar2:

(1) 
Varchar can have MAximum 2000 character while
Varchar can contain maximum 4000 character.

(2)
Varchar is of ANSI SQL standard.
Varchar2 is of Oracle standard.

(3) 
Varchar2 Datatype: The string value's length will be stored on disk with the value itself.

VARCHAR will occupy space for NULL values
VARCHAR2 datatype will not occupy any space.



Comments