ANYDATA介绍
admin
2023-05-07 01:21:18
0

ANYDATA特殊列,属于Oracle内建列,对于Oracle数据库,每一个值都是一种数据类型。当用户创建表或聚簇时,需要为每一个列指定对应的数据类型。即使是创建存储过程或函数的时,一样需要为参数指定相应的数据类型。

一个数据类型可以是标量的或非标量的,标的包含一个原子值,非标量的(有时成为集合)包含一个集合值。LOB(Large Object)就是一个特殊形式的标量数据类型表示大量的标量、二进制或字符数据,

Oracle内建数据类型可分为如下几类:

ANYDATA介绍

Oracle中通过Code代码来指代相应的数据类型,如下表所示:

Table 2-1 Built-in Data Type Summary

CodeData TypeDescription

1

VARCHAR2(size [BYTE | CHAR])

Variable-length character string having maximum length size bytes or characters. You must specify size for VARCHAR2. Minimum size is 1 byte or 1 character. Maximum size is:

  • 32767 bytes or characters ifMAX_STRING_SIZE = EXTENDED

  • 4000 bytes or characters ifMAX_STRING_SIZE = STANDARD

Refer to "Extended Data Types" for more information on the MAX_STRING_SIZEinitialization parameter.

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. You must specify size for NVARCHAR2. The number of bytes can be up to two timessize for AL16UTF16 encoding and three times size for UTF8 encoding. Maximumsize is determined by the national character set definition, with an upper limit of:

  • 32767 bytes if MAX_STRING_SIZE =EXTENDED

  • 4000 bytes if MAX_STRING_SIZE =STANDARD

Refer to "Extended Data Types" for more information on the MAX_STRING_SIZEinitialization parameter.

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. ANUMBER 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 FLOATvalue 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, 4712 BC, to December 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 YEAR, MONTH, DAY, HOUR,MINUTE, and SECOND. It does not have fractional seconds or a time zone.

100

BINARY_FLOAT

32-bit floating point number. This data type requires 4 bytes.

101

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 fractional_seconds_precision are 0 to 9. The default is 6. The default format is determined explicitly by theNLS_TIMESTAMP_FORMAT parameter or implicitly by the NLS_TERRITORY parameter. The size is 7 or 11 bytes, depending on the precision. This data type contains the datetime fields YEAR, MONTH, DAY, HOUR,MINUTE, and SECOND. It contains fractional seconds but does not have a time zone.

181

TIMESTAMP[(fractional_seconds_precision)] WITHTIME ZONE

All values of TIMESTAMP as well as time zone displacement value, wherefractional_seconds_precision is the number of digits in the fractional part of theSECOND datetime field. Accepted values are 0 to 9. The default is 6. The default format is determined explicitly by theNLS_TIMESTAMP_FORMAT parameter or implicitly by the NLS_TERRITORY parameter. The size is fixed at 13 bytes. This data type contains the datetime fields YEAR, MONTH,DAY, HOUR, MINUTE, SECOND,TIMEZONE_HOUR, and TIMEZONE_MINUTE. It has fractional seconds and an explicit time zone.

231

TIMESTAMP[(fractional_seconds_precision)] WITHLOCAL 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_TERRITORYparameter. The size is 7 or 11 bytes, depending on the precision.

182

INTERVAL YEAR [(year_precision)] TOMONTH

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)] TOSECOND[(fractional_seconds_precision)]

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_precisionis 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. You must specify size for a RAW value. Maximum size is:

  • 32767 bytes if MAX_STRING_SIZE =EXTENDED

  • 2000 bytes if MAX_STRING_SIZE =STANDARD

Refer to "Extended Data Types" for more information on the MAX_STRING_SIZEinitialization parameter.

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 type UROWID. The maximum size and default is 4000 bytes.

96

CHAR [(size [BYTE | CHAR])]

Fixed-length character data of length sizebytes or characters. Maximum size is 2000 bytes or characters. Default and minimumsize is 1 byte.

BYTE and CHAR have the same semantics as for VARCHAR2.

96

NCHAR[(size)]

Fixed-length character data of length sizecharacters. 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.


Any Types

 

Any类型用于处理未知的过程参数和表列的实际类型。该数据类型可以让你动态的封装和访问类型描述,数据实例和任何SQL类的实例数据集,这些类型由OCI和PL/SQL接口构造和访问

ANYTYPE

该类型包含一个对任何SQL类型的名或未命名的临时类型的类型描述。

ANYDATA

该类型包含一个给定的类型实例,数据类型加描述,ANYDATA可以向表中列的数据类型那样使用,并且将各种混杂的值存于该列之中。这些值可以是SQL内建类型和用户定义类型。

ANYDATASET

该类型包含一个给定的类型描述加类型实例集,ANYDATASET可灵活的用于过程参数数据类型,这些值同样可以是SQL内建类型和用户定义类型。

 

数据类型的介绍:

http://docs.oracle.com/database/121/SQLRF/sql_elements001.htm#SQLRF0021

相关内容

热门资讯

【珠城“健”闻】市三院引进非侵... 前沿科技赋能: 构建大脑与肢体的康复通路 技术优势对比: 与传统被动康复训练相比的显著突破 1.意...
从微信状态看社交边界 钟 颐 5月11日深夜,“微信状态 访客记录”话题冲上微博热搜,引发网友热议。微信方面表示,该功能仅...
中国科学家成功研制“九章四号”... 4月10日拍摄的“九章四号”量子计算原型机局部。 记者5月13日从中国科学技术大学获悉,该校潘建伟、...
江苏睿恩新能源申请正极极片及其... 国家知识产权局信息显示,江苏睿恩新能源科技有限公司申请一项名为“一种正极极片及其制备方法、锂离子电池...
流言|2026年地球会失重7秒... 流言:2026年8月12日地球将失重7秒、数千万人因此伤亡。 (图片由AI生成) 真相:“地球重...
从渠道赋能到行业基础设施 互联... 2025年,伴随数智技术的加速渗透,保险业的获客方式、决策逻辑乃至服务形态,都在被重新定义,互联网保...
人形机器人绕不开的坎:续航问题... 这两年,关于人形机器人的故事已经被讲了很多:AGI 的终极载体、万亿美元的劳动力替代、工厂和家庭的全...
合成生命重要突破 中国团队首次... 中新网北京5月13日电 (记者 孙自法)构建能够模拟天然细胞分裂行为的人工细胞,是合成生命研究至关重...
“九章四号”问世 中国科学家再... 4月10日拍摄的“九章四号”量子计算原型机局部。新华社记者 周牧 摄 新华社合肥5月13日电(记者陈...
索尼正面回应30%平台税:要养... 快科技5月13日消息,针对长期诟病的PlayStation商店30%抽成,索尼官方近日首度正面回应称...