“按表索引”和“按表索引”有什么区别?和“记录表索引”?
我遇到过这两个术语,但它们听起来是同义词。两者有区别吗?
I've come across both terms, but they sound synonymous. Is there a distinction between the two?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
“索引表”是 Oracle 中“关联数组”的术语。这些数组包含可以通过整数或字符串寻址(或索引)的元素。之所以这样称呼它们,可能是因为在定义数组时使用了 INDEX BY 关键字。
Oracle 文档中给出的示例的缩写< /a>:
您可以创建包含记录的索引表,其中记录本质上是包含多种类型的结构。例如,一条记录通常包含与表中的行相同的类型。
再次,来自 Oracle 文档:
这里, emp_tab是一个index-by表,以整数索引,包含employees%ROWTYPE的记录。
An "index-by table" is Oracle's term for "associative array". These are arrays that contain elements that you can address (or index by) either an integer or string. They're probably called that because of the use of the INDEX BY keywords when defining the array.
An abbreviation of the example given in the Oracle documentation:
You can create index-by tables containing records, where records are essentially a structure containing multiple types. A record, for example, often contains the same types as a row in a table.
Again, from the Oracle documentation:
Here, emp_tab is an index-by table, indexed by integers, containing records of employees%ROWTYPE.
我不确定您从哪里获得这些短语,但
TABLE OF
和INDEX BY
是集合类型声明的单独部分。TABLE OF
定义集合字段的类型,可以是数据类型(即TABLE OF NUMBER
)或记录类型(即TABLE OF MY_TABLE %类型)。
INDEX BY
指的是查找这个集合的方法,几乎就像一个键值对。例如,我可能会使用 INDEX BY VARCHAR2(10) ,以便可以使用文本键从集合类型中检索值。这是一个例子:
I'm not sure where you got the phrases from, but
TABLE OF
andINDEX BY
are separate parts of a collection type declaration.TABLE OF
defines the type of a collection's field(s), which can be a datatype (i.e.TABLE OF NUMBER
) or a record type (i.e.TABLE OF MY_TABLE%TYPE
).INDEX BY
refers to the method of looking up this collection, almost like a key-value pair. For example, I might useINDEX BY VARCHAR2(10)
so that I can use a textual key to retrieve a value from the collection type.Here's an illustration: