From Oracle FAQ
(Redirected from CHAR)
Jump to: navigation, search

CHAR is a data type used to store fixed-length character data. A char value can contain up to 2000 bytes of data (the limit was 255 bytes in Oracle 7). If you insert a value shorter than the specified length, Oracle will blank-pad the value. If you insert a value that is too long, Oracle will return an error.


SQL> CREATE TABLE char_test (col1 CHAR(10));

Table created.

SQL> INSERT INTO char_test VALUES ('qwerty');

1 row created.

Internal storage[edit]

Values are blank padded to the maximum declared length:

SQL> SELECT col1, length(col1), dump(col1) "ASCII Dump" FROM char_test;

------ ------------ --------------------------------------------------
qwerty           10 Typ=96 Len=10: 113,119,101,114,116,121,32,32,32,32

Note the four blanks (char 32) at the end of the string.

Also see[edit]

Glossary of Terms
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #