Oracle Data Types.
Oracle have mainly 5 built in datatypes.They are:
Oracle have mainly 5 built in datatypes.They are:
- CHARACTER data types.
- NUMBER data types.
- LONG data types.
- DATETIME data types.
- ROWID data types.
1) Character Data Types:
These Character data types stores character data as well as alphanumeric data also.
Character data types are mainly 4 types.They are
- Char
- Varchar
- Varchar2
- Nvarchar2
CHAR:
It stores only character data type information.The length of string is fixed.
here we have specify the size.The default size is 1 and maximum size is 2000 bytes.
VARCHAR:
It can store any type of text data including numbers,characters and special characters also.
Now it is deprecated (provided for backward compatibility only)
VARCHAR is a synonym for VARCHAR2 but this usage may change in future versions.
VARCHAR is a synonym for VARCHAR2 but this usage may change in future versions.
VARCHAR2:
It can store any type of text data including numbers,characters and special characters also.
its minimum size is 1 byte and maximum size is 4000 bytes.
NVARCHAR2:
Variable length national character set string having maximum length size bytes.
You must specify size from 1 byte to 4000 bytes.
You must specify size from 1 byte to 4000 bytes.
2) Number Data Types:
Number data type stores numeric data see the following example.
EX: NUMBER(Precision, Scale)
NUMBER(7,3)
In the following example 7 is the precision and 3 is the scale. i.e it can store 7 numbers as
4 numbers before the decimal point and 3 numbers after decimal point.
Example number: 4532.501
3) Long Data Type:
Long is data type which can store numbers and characters.
here the maximum size limit is 2 GB.
4) Date Time Data Type:
This data type can store Information about Date and Time.
The default date format for Oracle is DD-MON-YY
EX: 31-Aug-90.
5)ROWID Data Type:
Rowid treated as pseudo column,it stores column address of the table.
we can look into this uses of rowid in further chapters.