Translate

CHAR NCHAR VARCHAR VARCHAR2 NVARCHAR

Difference between CHAR NCHAR VARCHAR VARCHAR2 NVARCHAR

  • nchar and nvarchar can store Unicode characters.
  • char and varchar cannot store Unicode characters.
  • char and nchar are fixed-length which will reserve storage space for number of characters you specify even if you don't use up all that space.
  • varchar and nvarchar are variable-length which will only use up spaces for the characters you store. It will not reserve storage like char or nchar.

Difference between Varchar and Varchar2
  • VARCHAR is going to be replaced by VARCHAR2 in next version. So, Oracle suggests the use VARCHAR2 instead of VARCHAR while declaring datatype.
  • VARCHAR can store up to 2000 bytes of characters while VARCHAR2 can store up to 4000 bytes of characters.
  • If we declare datatype as VARCHAR then it will occupy space for NULL values, in case of VARCHAR2 datatype it will not occupy any space.



1 comment: