Oracle Data types

Oracle Datatypes identifies the type of data within table column. Datatypes are used to store data temporarily in computer through a program.

Types of datatypes:
Number
Character
Date

Numeric Datatypes

Data Type Description Storage
number(p,s) This allows to store number values in a column or variable. precision range: 1 to 38
float(b) Floating point numbers have a decimal point anywhere or can have no decimal point at all. precision range from 1 to 126
dec(p,s) Where p is precision and ‘s’ is the scale precision range: 1 to 38

Character Datatypes

Data Type Description Storage
char This is fixed length character string datatype. Maximum size is 2000 bytes
nchar Fixed length Unicode character data Maximum size is 2000 bytes.
varchar2 Variable length character datatype Maximum size is 4000 bytes
nvarchar2 It is defined for unicode character Maximum size is 4000 bytes
long Long stores variable length character data of upto 2 GB. Maximum size is 2Gigabytes
raw Stores variable lenght binary strings Maximum size is 2000bytes

Date Datatypes

Data Type Description
date This is used to store the date and time information. Range s 1 JAN 4712 BC to 31 DEC 4712
timestamp This stores in the format of Century, year, month, date, hour, minutes, second.

Default date format in Oracle is DD-MON-YYYY’. Example 16-AUG-2008.

Example1:

CREATE TABLE table_name(column1 number, column2 varchar2(23), column3 date)

Example2:

declare
employee_name varchar2;
begin
………
….end;

Powered by k2schools