Oracle/PLSQL: Data Types
The following is a list of datatypes available in Oracle.
Character Datatypes
Data Type Oracle 9i Oracle 10g Oracle 11g Explanation
Syntax (if applicable)
char(size) Maximum size of Maximum size of Maximum size of Where size is the number of characters to store. Fixed-
2000 bytes. 2000 bytes. 2000 bytes. length strings. Space padded.
nchar(size) Maximum size of Maximum size of Maximum size of Where size is the number of characters to store. Fixed-
2000 bytes. 2000 bytes. 2000 bytes. length NLS string Space padded.
nvarchar2(size) Maximum size of Maximum size of Maximum size of Where size is the number of characters to store. Variable-
4000 bytes. 4000 bytes. 4000 bytes. length NLS string.
varchar2(size) Maximum size of Maximum size of Maximum size of Where size is the number of characters to store. Variable-
4000 bytes. 4000 bytes. 4000 bytes. length string.
long Maximum size of Maximum size of Maximum size of Variable-length strings. (backward compatible)
2GB. 2GB. 2GB.
raw Maximum size of Maximum size of Maximum size of Variable-length binary strings
2000 bytes. 2000 bytes. 2000 bytes.
long raw Maximum size of Maximum size of Maximum size of Variable-length binary strings. (backward compatible)
2GB. 2GB. 2GB.
Numeric Datatypes
Data Type Oracle 9i Oracle 10g Oracle 11g Explanation
Syntax (if applicable)
number(p,s) Precision can range Precision can range Precision can range Where p is the precision and s is the scale.
from 1 to 38. from 1 to 38. from 1 to 38.
Scale can range from Scale can range from Scale can range from
-84 to 127. -84 to 127. -84 to 127. For example, number(7,2) is a number that has 5 digits
before the decimal and 2 digits after the decimal.
numeric(p,s) Precision can range Precision can range Precision can range Where p is the precision and s is the scale.
from 1 to 38. from 1 to 38. from 1 to 38.
For example, numeric(7,2) is a number that has 5 digits
before the decimal and 2 digits after the decimal.
float
dec(p,s) Precision can range Precision can range Precision can range Where p is the precision and s is the scale.
from 1 to 38. from 1 to 38. from 1 to 38.
For example, dec(3,1) is a number that has 2 digits before
the decimal and 1 digit after the decimal.
decimal(p,s) Precision can range Precision can range Precision can range Where p is the precision and s is the scale.
from 1 to 38. from 1 to 38. from 1 to 38.
For example, decimal(3,1) is a number that has 2 digits
before the decimal and 1 digit after the decimal.
integer
int
smallint
real
double
precision
Date/Time Datatypes
Data Type Oracle 9i Oracle 10g Oracle 11g Explanation
Syntax (if applicable)
date A date between Jan 1, 4712 A date between Jan 1, 4712 A date between Jan 1, 4712
BC and Dec 31, 9999 AD. BC and Dec 31, 9999 AD. BC and Dec 31, 9999 AD.
timestamp fractional seconds fractional seconds fractional seconds Includes year, month, day, hour,
(fractional seconds precision must be a number precision must be a number precision must be a number minute, and seconds.
precision) between 0 and 9. (default is between 0 and 9. (default is between 0 and 9. (default is
6) 6) 6)
For example:
timestamp(6)
timestamp fractional seconds fractional seconds fractional seconds Includes year, month, day, hour,
(fractional seconds precision must be a number precision must be a number precision must be a number minute, and seconds; with a time
precision) with time between 0 and 9. (default is between 0 and 9. (default is between 0 and 9. (default is zone displacement value.
zone 6) 6) 6)
For example:
timestamp(5) with time zone
timestamp fractional seconds fractional seconds fractional seconds Includes year, month, day, hour,
(fractional seconds precision must be a number precision must be a number precision must be a number minute, and seconds; with a time
precision) with local between 0 and 9. (default is between 0 and 9. (default is between 0 and 9. (default is zone expressed as the session
time zone 6) 6) 6) time zone.
For example:
timestamp(4) with local time
zone
interval year year precision is the year precision is the year precision is the Time period stored in years and
(year precision) number of digits in the year. number of digits in the year. number of digits in the year. months.
to month (default is 2) (default is 2) (default is 2)
For example:
interval year(4) to month
interval day day precision must be a day precision must be a day precision must be a Time period stored in days,
(day precision) number between 0 and 9. number between 0 and 9. number between 0 and 9. hours, minutes, and seconds.
to second (fractional (default is 2) (default is 2) (default is 2)
seconds precision)
For example:
fractional seconds fractional seconds fractional seconds interval day(2) to second(6)
precision must be a number precision must be a number precision must be a number
between 0 and 9. (default is between 0 and 9. (default is between 0 and 9. (default is
6) 6) 6)
Large Object (LOB) Datatypes
Data Oracle 9i Oracle 10g Oracle 11g Explanation
Type (if applicable)
Syntax
bfile Maximum file size Maximum file size of 232-1 bytes. Maximum file size of 264-1 bytes. File locators that point to a binary
of 4GB. file on the server file system
(outside the database).
blob Store up to 4GB of Store up to (4 gigabytes -1) * (the Store up to (4 gigabytes -1) * (the Stores unstructured binary large
binary data. value of the CHUNK parameter of value of the CHUNK parameter of objects.
LOB storage). LOB storage).
clob Store up to 4GB of Store up to (4 gigabytes -1) * (the Store up to (4 gigabytes -1) * (the Stores single-byte and multi-byte
character data. value of the CHUNK parameter of value of the CHUNK parameter of character data.
LOB storage) of character data. LOB storage) of character data.
nclob Store up to 4GB of Store up to (4 gigabytes -1) * (the Store up to (4 gigabytes -1) * (the Stores unicode data.
character text data. value of the CHUNK parameter of value of the CHUNK parameter of
LOB storage) of character text data. LOB storage) of character text data.
Rowid Datatypes
Data Type Oracle 9i Oracle 10g Oracle 11g Explanation
Syntax (if applicable)
rowid The format of the rowid is: The format of the rowid is: The format of the rowid is: Fixed-length binary data.
BBBBBBB.RRRR.FFFFF BBBBBBB.RRRR.FFFFF BBBBBBB.RRRR.FFFFF Every record in the database
has a physical address
or rowid.
Where BBBBBBB is the block Where BBBBBBB is the block Where BBBBBBB is the block
in the database file; in the database file; in the database file;
RRRR is the row in the block; RRRR is the row in the block; RRRR is the row in the block;
FFFFF is the database file. FFFFF is the database file. FFFFF is the database file.
urowid(size) Universal rowid.
Where size is optional.