VARCHAR2 and VARCHAR Datatypes
TheVARCHAR2
datatype stores variable-length character strings. When you create a table with a VARCHAR2
column, you specify a maximum string length (in bytes or characters) between 1 and 4000 bytes for the VARCHAR2
column. For each row, Oracle Database stores each value in the column as a variable-length field unless a value exceeds the column's maximum length, in which case Oracle Database returns an error. Using VARCHAR2
and VARCHAR
saves on space used by the table.For example, assume you declare a column
VARCHAR2
with a maximum size of 50 characters. In a single-byte character set, if only 10 characters are given for the VARCHAR2
column value in a particular row, the column in the row's row piece stores only the 10 characters (10 bytes), not 50.Oracle Database compares
VARCHAR2
values using nonpadded comparison semantics.VARCHAR Datatype
TheVARCHAR
datatype is synonymous with the VARCHAR2
datatype. To avoid possible changes in behavior, always use the VARCHAR2
datatype to store variable-length character strings.
0 comments:
Post a Comment