Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

CHARACTER - String with a fixed length

You use the data type CHARACTER or CHAR for columns that can store alphanumeric values of a fixed length (see section "Alphanumeric literals").


[{[ dimension ] | ( dimension )}] CHAR[ACTER][( length )]


dimension

Unsigned integer between 1 and 255. The column is a multiple column; dimension indicates the number of column elements. dimension can be enclosed in square brackets or parentheses.

Any square brackets shown here in italics are special characters, and must be specified in the statement.

dimension omitted:
The column is an atomic column.

length

Unsigned integer between 1 and 256 that indicates the length of the CHAR column.

length omitted:
length=1.


Range of values for CHAR columns

A CHAR column can contain alpnanumeric values of the length specified for the column.


Example

The CUSTOMERS table contains 6 CHAR columns of varying lengths.
The values that the columns can store are alphanumeric strings with a length of 3,
25, 40 and 50 respectively:

company      CHAR(40) NOT NULL
street       CHAR(40)
city         CHAR(40)
country      CHAR(3)
cust_tel     CHAR(25)
cust_info    CHAR(50)