Oracle Built-in Data Types(Oracle内置数据类型)

Oracle Built-in(嵌入的,内置) Data Types

The table that follows(跟随,遵照) summarizes(总结,概述) Oracle built-in data types. Refer(参考,查阅) to the syntax(语法,句法)in the preceding(在...之前,前) sections(截面,节段,部分) for the syntactic(句法的,语法结构) elements(元素,成份,原理). The codes(编码,代码) listed(列出) for the data types are used internally(内部的) by Oracle Database. The data type code of a column or object attribute is returned by the DUMP(倾倒) function.

Table 3-1 Built-in Data Type Summary(概要,简要)

Code Data Type Description

1

VARCHAR2(size [BYTE(字节) | CHAR(把数值,字符)])

Variable-length(变长,可变长度) character(字符,特性) string having(所有,具有) maximum length size bytes or characters. Maximum size is 4000 bytes or characters, and minimum is 1 byte or 1 character. You must specify(指定,列举) size for VARCHAR2.

BYTE indicates(指示,表明) that the column will have(将有) byte length semantics(语义). CHAR indicates that the column will have character semantics.

1

NVARCHAR2(size)

Variable-length Unicode character string having maximum length size characters. The number of bytes can be up to two times size(可达两倍大小) for(为) AL16UTF16 encoding and three times size for UTF8 encoding(3次UTF8编码的大小). Maximum size is determined(决定了) by the national character set(集合) definition(定义,解说), with(支持) an upper(上面的,较高的) limit(限制) of 4000 bytes. You must specify size for NVARCHAR2.

2

NUMBER [ (p [, s]) ]

Number having precision(精度,精确的) p and scale(刻度) s. The precision p can range(范围) from 1 to 38. The scale s can range from -84 to 127. Both(两者) precision and scale are in decimal digits(小数位数). A NUMBER value requires(需要) from 1 to 22 bytes.

2

FLOAT [(p)]

A subtype(图表类型) of the NUMBER data type having precision p. A FLOAT value is represented(代表,表现) internally(内部) as NUMBER. The precision p can range from 1 to 126 binary digits(二进制数字). A FLOAT value requires(需要) from 1 to 22 bytes.

8

LONG

Character data of variable length up to 2 gigabytes(十亿字节), or 231 -1 bytes. Provided(假如,提供) for backward(向后的) compatibility(兼容性).

12

DATE

Valid(有效的,正确的) date range from January(1月) 1, 4712 BC(公元前4712), to December(12月) 31, 9999 AD. The default format is determined(决定) explicitly(明确的) by(由) theNLS_DATE_FORMAT parameter or implicitly(含蓄的,暗中的) by the NLS_TERRITORY parameter. The size is fixed(固定的) at 7 bytes. This data type contains(包含) the datetime fields(域) YEARMONTHDAYHOURMINUTE, and SECOND. It does not have(没有) fractional(小数的) seconds or a time zone(时区).

21

BINARY_FLOAT

32-bit floating point(点,要点) number. This data type requires(需要) 4 bytes.

22

BINARY_DOUBLE

64-bit floating point number. This data type requires 8 bytes.

180

TIMESTAMP [(fractional_seconds_precision)]

Year, month, and day values of date, as well as hour, minute, and second values of time, where fractional_seconds_precision is the number of digits(数字) in the fractional(小数) part(部分) of the SECOND datetime(日期时间字段域) field. Accepted(接受) values of ractional_seconds_precisionf are 0 to 9. The default is 6. The default format is determined(决定,确定) explicitly(明确的) by the NLS_TIMESTAMP_FORMAT parameter or implicitly by the NLS_TERRITORYparameter. The size is 7 or 11 bytes, depending on(取决于,根据) the precision(不同的精度). This data type contains the datetime fields YEARMONTHDAYHOUR,MINUTE, and SECOND. It contains fractional seconds(分数秒) but does not have a time zone.

181

TIMESTAMP [(fractional_seconds)] WITH TIME ZONE

All values of TIMESTAMP as well as(也,和...一样) time zone displacement(取代,位移) value, where fractional_seconds_precision is the number of digits in the fractional part(数字的小数部分的位数) of the SECOND datetime field(日期时间字段). Accepted values are 0 to 9. The default is 6. The default format is determined explicitly by the NLS_TIMESTAMP_FORMAT parameter or implicitly by the NLS_TERRITORY parameter. The size is fixed at 13 bytes. This data type contains the datetime fields() YEARMONTHDAYHOURMINUTESECONDTIMEZONE_HOUR, and TIMEZONE_MINUTE. It has fractional seconds and an explicit(明确的) time zone.

231

TIMESTAMP [(fractional_seconds)] WITH LOCAL TIME ZONE

All values of TIMESTAMP(时间戳) WITH TIME ZONE, with the following exceptions(以下例外):

  • Data is normalized(标准化的) to the database time zone when it is stored(存储,储存的) in the database.

  • When the data is retrieved(恢复,检索), users see the data in the session time zone.

The default format is determined(决定,确定) explicitly(明确) by the(由) NLS_TIMESTAMP_FORMAT parameter or implicitly by the NLS_TERRITORY parameter. The size is 7 or 11 bytes, depending on the precision.

182

INTERVAL YEAR [(year_precision)] TO MONTH

Stores(存储) a period(周期,期间) of time in years and months, where year_precision is the number of digits in the YEAR datetime field. Accepted values are 0 to 9. The default is 2. The size is fixed(固定) at 5 bytes.

183

INTERVAL DAY [(day_precision)] TO SECOND [(fractional_seconds)]

Stores a period of time in days, hours, minutes, and seconds, where

  • day_precision is the maximum number of digits in the DAY datetime field. Accepted values are 0 to 9. The default is 2.

  • fractional_seconds_precision is the number of digits(在...位数) in the fractional part(小数部位) of the SECOND field(第二个字段). Accepted values are 0 to 9. The default is 6.

The size is fixed at 11 bytes.

23

RAW(size)

Raw(生的,原始) binary data of length size bytes. Maximum size is 2000 bytes. You must specify size for a RAW value(原始值).

24

LONG RAW

Raw binary data of variable length up(可达) to 2 gigabytes(千兆字节).

69

ROWID

Base(基地) 64 string representing(代表) the unique(唯一的,独特的) address of a row in its table. This data type is primarily(主要) for values returned by the ROWIDpseudocolumn.

208

UROWID [(size)]

Base 64 string representing the logical(合乎逻辑的) address of a row of an index-organized(索引组织) table. The optional(可选) size is the size of a column of typeUROWID(是typeUROWID列的大小). The maximum size and default is 4000 bytes.

96

CHAR [(size [BYTE | CHAR])]

Fixed-length(固定长度) character data of length size bytes or characters. Maximum size is 2000 bytes or characters. Default and minimum sizeis 1 byte.

BYTE and CHAR have the same(相同) semantics(语义) as for VARCHAR2.

96

NCHAR[(size)]

Fixed-length character data of length size characters. The number of bytes can be up to(最多可以有) two times size for AL16UTF16 encoding and three times size for UTF8 encoding. Maximum size is determined(取决于,决定) by the national(国家) character set(字符集) definition(定义), with an upper limit(上限) of 2000 bytes. Default and minimum size is 1 character.

112

CLOB

A character large(大) object containing single(单一的,单个的)-byte or multibyte(多字节的) characters. Both fixed-width and variable-width character sets are supported(支持), both(两者) using the database character set. Maximum size is (4 gigabytes - 1) * (database block(块) size).

112

NCLOB

A character large object containing Unicode characters. Both fixed-width and variable-width character sets are supported, both using the database national character set(数据库国家字符集). Maximum size is (4 gigabytes - 1) * (database block size). Stores national character set data.

113

BLOB

A binary large object. Maximum size is (4 gigabytes - 1) * (database block size).

114

BFILE

Contains a locator(定位) to a large binary file stored outside(外面的,外部的) the database. Enables(使...) byte stream(字节流) I/O access(进入,访问) to external(外部,表面的) LOBs residing(居于,居住) on the database server. Maximum size is 4 gigabytes.


The sections(部分,截面) that follow describe the Oracle data types as they are stored in Oracle Database. For information(信息) on specifying these data types as literals(文字), refer(参考) to "Literals".

你可能感兴趣的:(Oracle Built-in Data Types(Oracle内置数据类型))