0% found this document useful (0 votes)
109 views

Character Datatypes: Data Type Syntax Oracle 9i Oracle 10g Oracle 11g Explanation (If Applicable)

The document summarizes datatypes available in Oracle databases from versions 9i to 11g. It lists character, numeric, date/time, and interval datatypes and provides explanations and examples of how each datatype stores data. Character datatypes include char, nchar, nvarchar2, varchar2, long, and long raw. Numeric datatypes include number, numeric, float, dec, decimal, integer, int, smallint, real, and double precision. Date/time datatypes include date, timestamp with fractional seconds precision, timestamp with fractional seconds precision and time zone, and timestamp with fractional seconds precision and local time zone. The interval datatype stores time periods in years and months.

Uploaded by

Pankaj Chauhan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views

Character Datatypes: Data Type Syntax Oracle 9i Oracle 10g Oracle 11g Explanation (If Applicable)

The document summarizes datatypes available in Oracle databases from versions 9i to 11g. It lists character, numeric, date/time, and interval datatypes and provides explanations and examples of how each datatype stores data. Character datatypes include char, nchar, nvarchar2, varchar2, long, and long raw. Numeric datatypes include number, numeric, float, dec, decimal, integer, int, smallint, real, and double precision. Date/time datatypes include date, timestamp with fractional seconds precision, timestamp with fractional seconds precision and time zone, and timestamp with fractional seconds precision and local time zone. The interval datatype stores time periods in years and months.

Uploaded by

Pankaj Chauhan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

The following is a list of datatypes available in Oracle.

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.

range from 1 range from 1 range from 1 For example, numeric(7,2) is a


to 38. to 38. to 38. number that has 5 digits before
the decimal and 2 digits after the
decimal.
float        
Where p is the precision and s is
the scale.
Precision can Precision can Precision can
dec(p,s) range from 1 range from 1 range from 1 For example, dec(3,1) is a
to 38. to 38. to 38. number that has 2 digits before
the decimal and 1 digit after the
decimal.
Where p is the precision and s is
the scale.
Precision can Precision can Precision can
decimal(p,s) range from 1 range from 1 range from 1 For example, decimal(3,1) is a
to 38. to 38. to 38. 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 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)

Q:)What is the difference between varchar and varchar2?


Varchar means fixed length character data(size) ie., min size-1 and max-2000
where as varchar2 means variable length character data ie., min-1 to max-4000

You might also like