Character Datatypes: Data Type Syntax Oracle 9i Oracle 10g Oracle 11g Explanation (If Applicable)
Character Datatypes: Data Type Syntax Oracle 9i Oracle 10g Oracle 11g Explanation (If Applicable)
Character Datatypes
Data Type Explanation
Oracle 9i Oracle 10g Oracle 11g
Syntax (if applicable)
Where size is the number of
Maximum size Maximum size Maximum size
char(size) characters to store. Fixed-
of 2000 bytes. of 2000 bytes. of 2000 bytes.
length strings. Space padded.
Where size is the number of
Maximum size Maximum size Maximum size characters to store. Fixed-
nchar(size)
of 2000 bytes. of 2000 bytes. of 2000 bytes. length NLS string Space
padded.
Where size is the number of
Maximum size Maximum size Maximum size
nvarchar2(size) characters to store. Variable-
of 4000 bytes. of 4000 bytes. of 4000 bytes.
length NLS string.
Where size is the number of
Maximum size Maximum size Maximum size
varchar2(size) characters to store. Variable-
of 4000 bytes. of 4000 bytes. of 4000 bytes.
length string.
Maximum size Maximum size Maximum size Variable-length strings.
long
of 2GB. of 2GB. of 2GB. (backward compatible)
Maximum size Maximum size Maximum size
raw Variable-length binary strings
of 2000 bytes. of 2000 bytes. of 2000 bytes.
Maximum size Maximum size Maximum size Variable-length binary strings.
long raw
of 2GB. of 2GB. of 2GB. (backward compatible)
Numeric Datatypes
Data Type Explanation
Oracle 9i Oracle 10g Oracle 11g
Syntax (if applicable)
Where p is the precision and s is
Precision can Precision can Precision can
the scale.
range from 1 range from 1 range from 1
to 38. to 38. to 38.
number(p,s) For example, number(7,2) is a
Scale can Scale can Scale can
number that has 5 digits before
range from range from range from
the decimal and 2 digits after the
-84 to 127. -84 to 127. -84 to 127.
decimal.
numeric(p,s) Precision can Precision can Precision can Where p is the precision and s is
the scale.
Date/Time Datatypes
Data Type Explanation
Oracle 9i Oracle 10g Oracle 11g
Syntax (if applicable)
A date between A date between A date between
Jan 1, 4712 BC Jan 1, 4712 BC Jan 1, 4712 BC
date
and Dec 31, and Dec 31, and Dec 31,
9999 AD. 9999 AD. 9999 AD.
timestamp fractional fractional fractional Includes year, month,
(fractional seconds seconds seconds day, hour, minute, and
precision must precision must precision must seconds.
seconds be a number be a number be a number
precision) between 0 and 9. between 0 and 9. between 0 and 9. For example:
(default is 6) (default is 6) (default is 6) timestamp(6)
Includes year, month,
day, hour, minute, and
fractional fractional fractional
timestamp seconds; with a time
seconds seconds seconds
(fractional zone displacement
precision must precision must precision must
seconds value.
be a number be a number be a number
precision) with
between 0 and 9. between 0 and 9. between 0 and 9.
time zone For example:
(default is 6) (default is 6) (default is 6)
timestamp(5) with
time zone
Includes year, month,
day, hour, minute, and
fractional fractional fractional
timestamp seconds; with a time
seconds seconds seconds
(fractional zone expressed as the
precision must precision must precision must
seconds session time zone.
be a number be a number be a number
precision) with
between 0 and 9. between 0 and 9. between 0 and 9.
local time zone For example:
(default is 6) (default is 6) (default is 6)
timestamp(4) with
local time zone
Time period stored in
year precision is year precision is year precision is years and months.
interval year
the number of the number of the number of
(year precision)
digits in the year. digits in the year. digits in the year. For example:
to month
(default is 2) (default is 2) (default is 2) interval year(4) to
month
day precision day precision day precision
must be a must be a must be a
number between number between number between
Time period stored in
interval day 0 and 9. (default 0 and 9. (default 0 and 9. (default
days, hours, minutes,
(day precision) is 2) is 2) is 2)
and seconds.
to second
(fractional fractional fractional fractional
For example:
seconds seconds seconds seconds
interval day(2) to
precision) precision must precision must precision must
second(6)
be a number be a number be a number
between 0 and 9. between 0 and 9. between 0 and 9.
(default is 6) (default is 6) (default is 6)