If you assign a value
that??™s shorter than the length specified for the CHAR datatype, Oracle will automatically
pad the value with blanks. Some examples of CHAR values are:
CHAR(10) = "Rick ", "Jon ", "Stackowiak"
VARCHAR2
The VARCHAR2 datatype stores variable-length character strings. Although you
must assign a length to a VARCHAR2 datatype, this length is the maximum
length for a value rather than the required length. Values assigned to a
VARCHAR2 datatype aren??™t padded with blanks. The VARCHAR2 datatype can
have up to 4,000 characters. Because of this, a VARCHAR2 datatype can require
less storage space than a CHAR datatype, because the VARCHAR2 datatype
stores only the characters assigned to the column.
At this time, the VARCHAR and VARCHAR2 datatypes are synonymous in
Oracle8 and later versions, but Oracle recommends the use of VARCHAR2
because future changes may cause VARCHAR and VARCHAR2 to diverge. The
values shown earlier for the CHAR values, if entered as VARCHAR2 values, are:
VARCHAR2(10) = "Rick", "Jon", "Stackowiak"
NCHAR and NVARCHAR2
The NCHAR and NVARCHAR2 datatypes store fixed-length or variable-length
character data, respectively, using a different character set from the one used by
the rest of the database.
Pages:
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199