Categories
CHAR Datatype Oracle VARCHAR2

Oracle VARCHAR2(1) vs CHAR(1)?

Well, minimum size for both Oracle datatypes is 1 byte. So in terms of storage, they’ll both consume either null or 1 byte in storage space. So, when declaring a character datatype with a length of 1, it doesn’t really matter which one you use. The rules change when the length is greater than 1 though.

This is because CHAR is a fixed character data, so values held in this datatype is always RPAD’ed with blanks. Storing character data as VARCHAR2 will save space on, not just the character field, but any indexes that reference it.

As a personal preference, I always use VARCHAR2. The most important practice though is to be consistent. For example, if you use CHAR for a 1 byte character datatype and VARCHAR2 for everything else, then stick with it throughout your whole database.