We have discussed the contention between char and varchar in MySQL databases before, knowing under what circumstances the Char character type data is used and under what circumstances the Varchar character type data is used. This time VarChar2 was introduced to discuss and compare the three, but the database changed from MySQL to Oracle.
In Oracle databases, there are three character types: Char, VarChar, and VarChar2, but it is not clear where the differences are. Generally, VarChar is used to only know that it can save space, how much data is stored in China to the maximum extent. The differences are described below.
Char: The length is fixed and the length is 2000
VarChar: industrial standard type, variable-length data type, maximum length of 2000
VarChar2: Oracle-specific data type with variable length. The maximum length is 4000.
In space, Char is more space-consuming than VarChar and VarChar2, because no matter how much content is stored, its length is 2000, while VarChar and VarChar2 save more space because of variable length.
In terms of efficiency, Char is slightly higher than VarChar and VarChar2. If VarChar and VarChar2 are modified more often and the length of the modified data is different each time, this will cause "Row migration.
VarChar compatibility with other databases
VarChar2 is unique to Oracle