Oracle Char, VarChar & VarChar2 comparison

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.