The following table lists the common character types.

Name Description
CHAR[(n)] Fixed-length character string, blank-padded to the size specified by n.
CLOB Large variable-length up to 1 GB.
LONG Variable unlimited length.
NVARCHAR(n) Variable-length national character string, with limit.
NVARCHAR2(n) Variable-length national character string, with limit.
STRING Alias for VARCHAR2.
VARCHAR(n) Variable-length character string, with limit (considered deprecated, but supported for compatibility).
VARCHAR2(n) Variable-length character string, with limit.
Note In the preceding table, n is a positive integer. These types can store strings that contain up to n characters in length. An attempt to assign a value that exceeds the length of n will result in an error, unless the excess characters are all spaces. In this case, the string will be truncated to the maximum length.

CHAR

For the CHAR type, if you do not specify a value for n, the default value is 1. If the string to be stored is shorter than n, a value of the CHAR type is space-padded to the specified length n, and is stored and displayed that way.

Padding spaces are insignificant in semantics. This indicates that trailing spaces are disregarded when you compare two CHAR values, and the spaces are removed when a CHAR value is converted to another string type.

If you explicitly cast a value to a CHAR(n) type, an over-length value is truncated to n characters without generating an error. This is the same as that specified by the SQL standards.

VARCHAR, VARCHAR2, NVARCHAR, and NVARCHAR2

If the string to be assigned is shorter than n, the VARCHAR, VARCHAR2, NVARCHAR, and NVARCHAR2 value types store the string of the actual length without padding spaces.

Note Trailing spaces of the VARCHAR values are significant in semantics.

If you explicitly cast a value to a VARCHAR type, an over-length value is truncated to n characters without generating an error. This is the same as that specified by the SQL standards.

CLOB

You can store a long string in the CLOB type. CLOB is equivalent to VARCHAR2 in semantics except that no length limit is specified for CLOB. We recommend that you use the CLOB type instead of the VARCHAR2 type if the maximum string length is unknown.
Note The longest character string that can be stored in the CLOB type is about 1 GB.

Considerations

The storage requirement for data of these types is the actual string plus 1 byte if the string is less than 127 bytes. If the string is 127 bytes or larger, the data of these types is the actual string plus 4 bytes. For data of the CHAR type, the trailing spaces of a string also require the storage space. Long strings are automatically compressed by the system. In this case, less actual storage space is required on disks. Long string values are stored in background tables. Therefore, when you query short column values, the query speed is not affected by the long string values.

The database character set determines the character set used to store textual values.