2
Reply

What is difference between CHAR and VARCHAR2? What is the maximum SIZE allowed for each type?

Gaurav Malviya

Gaurav Malviya

10y
1.5k
0
Reply

    char [ ( n ) ]Fixed-length, non-Unicode string data. n defines the string length and must be a value from 1 through 8,000. The storage size is n bytes. The ISO synonym for char is character. varchar [ ( n | max ) ]Variable-length, non-Unicode string data. n defines the string length and can be a value from 1 through 8,000. max indicates that the maximum storage size is 2^31-1 bytes (2 GB). The storage size is the actual length of the data entered 2 bytes. The ISO synonyms for varchar are char varying or character varying.Use char when the sizes of the column data entries are consistent.Use varchar when the sizes of the column data entries vary considerably.Use varchar(max) when the sizes of the column data entries vary considerably, and the size might exceed 8,000 bytes.

    CHAR pads blank spaces to the maximum length. 
    VARCHAR2 does not pad blank spaces. 
    For CHAR the maximum length is 255 and 2000 for VARCHAR2.