DataTypes

The following is a list of datatypes available in Oracle.

Character Datatypes

Data Type
Syntax
Oracle 9iOracle 10gOracle 11gExplanation
(if applicable)
char(size)Maximum size of 2000 bytes.Maximum size of 2000 bytes.Maximum size of 2000 bytes.Where size is the number of characters to store. Fixed-length strings. Space padded.
nchar(size)Maximum size of 2000 bytes.Maximum size of 2000 bytes.Maximum size of 2000 bytes.Where size is the number of characters to store. Fixed-length NLS string Space padded.
nvarchar2(size)Maximum size of 4000 bytes.Maximum size of 4000 bytes.Maximum size of 4000 bytes.Where size is the number of characters to store. Variable-length NLS string.
varchar2(size)Maximum size of 4000 bytes.Maximum size of 4000 bytes.Maximum size of 4000 bytes.Where size is the number of characters to store. Variable-length string.
longMaximum size of 2GB.Maximum size of 2GB.Maximum size of 2GB.Variable-length strings. (backward compatible)
rawMaximum size of 2000 bytes.Maximum size of 2000 bytes.Maximum size of 2000 bytes.Variable-length binary strings
long rawMaximum size of 2GB.Maximum size of 2GB.Maximum size of 2GB.Variable-length binary strings. (backward compatible)

 

Numeric Datatypes

Data Type
Syntax
Oracle 9iOracle 10gOracle 11gExplanation
(if applicable)
number(p,s)Precision can range from 1 to 38.
Scale can range from -84 to 127.
Precision can range from 1 to 38.
Scale can range from -84 to 127.
Precision can range from 1 to 38.
Scale can range from -84 to 127.
Where p is the precision and s is the scale.

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 from 1 to 38.Precision can range from 1 to 38.Precision can range from 1 to 38.Where p is the precision and s is the scale.

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 from 1 to 38.Precision can range from 1 to 38.Precision can range from 1 to 38.Where p is the precision and s is the scale.

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 from 1 to 38.Precision can range from 1 to 38.Precision can range from 1 to 38.Where p is the precision and s is the scale.

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
Syntax
Oracle 9iOracle 10gOracle 11gExplanation
(if applicable)
dateA date between Jan 1, 4712 BC and Dec 31, 9999 AD.A date between Jan 1, 4712 BC and Dec 31, 9999 AD.A date between Jan 1, 4712 BC and Dec 31, 9999 AD.

 

timestamp (fractional seconds precision) fractional seconds precision must be a number between 0 and 9. (default is 6) fractional seconds precision must be a number between 0 and 9. (default is 6) fractional seconds precision must be a number between 0 and 9. (default is 6)

Includes year, month, day, hour, minute, and seconds.

For example:
timestamp(6)

timestamp (fractional seconds precision) with time zone fractional seconds precision must be a number between 0 and 9. (default is 6) fractional seconds precision must be a number between 0 and 9. (default is 6) fractional seconds precision must be a number between 0 and 9. (default is 6)

Includes year, month, day, hour, minute, and seconds; with a time zone displacement value.

For example:
timestamp(5) with time zone

timestamp (fractional seconds precision) with local time zone fractional seconds precision must be a number between 0 and 9. (default is 6) fractional seconds precision must be a number between 0 and 9. (default is 6) fractional seconds precision must be a number between 0 and 9. (default is 6)Includes year, month, day, hour, minute, and seconds; with a time zone expressed as the session time zone.

For example:
timestamp(4) with local time zone

interval year
(year precision)
to month
year precision is the number of digits in the year. (default is 2) year precision is the number of digits in the year. (default is 2) year precision is the number of digits in the year. (default is 2)Time period stored in years and months.

For example:
interval year(4) to month

interval day
(day precision)
to second (fractional seconds precision)
day precision must be a number between 0 and 9. (default is 2)

fractional seconds precision must be a number between 0 and 9. (default is 6)

day precision must be a number between 0 and 9. (default is 2)

fractional seconds precision must be a number between 0 and 9. (default is 6)

day precision must be a number between 0 and 9. (default is 2)

fractional seconds precision must be a number between 0 and 9. (default is 6)

Time period stored in days, hours, minutes, and seconds.

For example:
interval day(2) to second(6)

 

Large Object (LOB) Datatypes

Data Type
Syntax
Oracle 9iOracle 10gOracle 11gExplanation
(if applicable)
bfileMaximum file size of 4GB.Maximum file size of 232-1 bytes.Maximum file size of 264-1 bytes.File locators that point to a binary file on the server file system (outside the database).
blobStore up to 4GB of binary data.Store up to (4 gigabytes -1) * (the value of the CHUNK parameter of LOB storage).Store up to (4 gigabytes -1) * (the value of the CHUNK parameter of LOB storage).Stores unstructured binary large objects.
clobStore up to 4GB of character data.Store up to (4 gigabytes -1) * (the value of the CHUNK parameter of LOB storage) of character data.Store up to (4 gigabytes -1) * (the value of the CHUNK parameter of LOB storage) of character data.Stores single-byte and multi-byte character data.
nclobStore up to 4GB of character text data.Store up to (4 gigabytes -1) * (the value of the CHUNK parameter of LOB storage) of character text data.Store up to (4 gigabytes -1) * (the value of the CHUNK parameter of LOB storage) of character text data.Stores unicode data.

 

Rowid Datatypes

Data Type
Syntax
Oracle 9iOracle 10gOracle 11gExplanation
(if applicable)
rowidThe format of the rowid is: BBBBBBB.RRRR.FFFFF

Where BBBBBBB is the block in the database file;
RRRR is the row in the block;
FFFFF is the database file.

The format of the rowid is: BBBBBBB.RRRR.FFFFF

Where BBBBBBB is the block in the database file;
RRRR is the row in the block;
FFFFF is the database file.

The format of the rowid is: BBBBBBB.RRRR.FFFFF

Where BBBBBBB is the block in the database file;
RRRR is the row in the block;
FFFFF is the database file.

Fixed-length binary data. Every record in the database has a physical address or rowid.
urowid(size)   Universal rowid.

Where size is optional.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值