In oracle, each ‘column value’ and constant in SQL expression has a ‘DataType’ which is related with a distinct storage format, constraints and well founded range of values of that datatype. The datatype associates with specific value in the table. So by this Oracle is able to treat values of one datatype differently from values of another datatype.
It is easy for humans to distinguish between different types of data. A datatype says what type of value it will take. We have to decide what types of data will be stored inside each and every table column when creating a SQL table, so it is very important to decide what types of datatypes will store in a column.
For example, assume we declare a column VARCHAR2 with a maximum size of 50 characters in our table. If only 20 characters are given for the VARCHAR2 column value in a particular row, the column in the row's row piece stores only the 20 characters (20 bytes) only. So what we have assigned that byte of character will take the space of what we haven't declared.
There are followings types of built-in datatypes in Oracle, which is explained below:
Character Datatypes
-
CHAR - Char datatypes is fixed-length character data of length size bytes or characters and the maximum size is 2000 bytes per row, default size is 1 byte per row.
-
NCHAR - The NCHAR datatype stores fixed-length character strings. The maximum length of an NCHAR column is 2000 bytes.
-
VARCHAR2 & VARCHAR - The VARCHAR datatype is synonymous with the VARCHAR2 datatype. To avoid possible changes in behavior always use the VARCHAR2 datatype to store variable-length character strings.
-
NVARCHAR2 - The NVARCHAR2 datatype stores variable length character strings and the maximum length of an NVARCHAR2 column is 4000 bytes.
-
CLOB - Single-byte character data. Up to 232 - 1 bytes or 4 gigabytes.
-
NCLOB - Unicode national character set (NCHAR) data. Up to 232 - 1 bytes, or 4 gigabytes.
-
LONG - LONG datatypes is variable-length character data. Variable for each row in the table up to 232 - 1 bytes or 2 gigabytes, per row. Provided for backward compatibility.
