oracle 对象和记录类型的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10848277/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 04:13:12  来源:igfitidea点击:

Difference between object and record type

oracle

提问by redsoxlost

I am just curious whats the difference between object and record type in oracle, More specifically between the below declarations

我只是好奇 oracle 中的对象和记录类型之间有什么区别,更具体地说是以下声明之间

create type emp2_oty is object 
(
 empno  number,
 ename  varchar2(20),
 deptno number
);

create type emp2_nt is table of emp2_oty;

and

type emp2_oty is record
(
 empno  number,
 ename  varchar2(20),
 deptno number
);

create type emp2_nt is table of emp2_oty;

Please elaborate.

请详细说明。

采纳答案by Jeffrey Vandenborne

The OBJECT type can be stored in the database and can be used in both SQL and PL/SQL

OBJECT 类型可以存储在数据库中,可以在 SQL 和 PL/SQL 中使用

回答by venu

  • record:

       Cannot be stored in the database.
       Cannot be recursively referenced.
       Cannot have logic defined as part of their definition.
    
  • object:

       Can be stored as a database table column or as an entire row.
       Can be recursively referenced using the SELF parameter.
       Can have logic defined as part of their definition using member methods.
    
  • 记录:

       Cannot be stored in the database.
       Cannot be recursively referenced.
       Cannot have logic defined as part of their definition.
    
  • 目的:

       Can be stored as a database table column or as an entire row.
       Can be recursively referenced using the SELF parameter.
       Can have logic defined as part of their definition using member methods.