Char, Varchar, Varchar2 in Oracle SQL

  • CHAR should be used for storing fixed length character strings. String values will be space/blank padded before stored on disk. If this type is used to store variable length strings, it will waste a lot of disk space.
  • Currently VARCHAR behaves exactly the same as VARCHAR2. However, this type should not be used as it is reserved for future usage.
    • In Varchar null and blank(space) is treated as same which caused conflict in the modern world where null and blank where considered as blank hence Varchar2 is used nowadays and VARCHAR is planned to change in future releases.
  • VARCHAR2 is used to store variable length character strings. The string value’s length will be stored on disk with the value itself. Max DEFAULT length of VARCHAR2 is 4000 and it can be changed by changing some parameters in DB.

Leave a Comment